Writes a reply to each new support email, asks you to approve it, and sends it or leaves it as a draft.
Uses
Claude
Gmail
Review and send replies to support enquiries
Every hour, the unread support mail matching a Gmail search you choose is read, and a reply to each message is written by AI from a description of your business and tone that you provide once. Anything it cannot answer from that description becomes a short acknowledgement saying a colleague will follow up, rather than an invented answer.
Before anything reaches a customer you are asked to approve the reply, shown in full next to what the customer wrote. Approve it and it goes straight away, as a reply in the customer's own email conversation; reject it, or leave it, and it is saved as a Gmail draft in that conversation instead, so nothing is lost and nothing is sent that a person did not approve. Unless you name approvers on the approval step, anyone in your Lodol workspace can approve. A message waiting on you is labelled 'Reply awaiting approval' and a handled one 'Reply handled', so no enquiry is taken twice, and the batch is kept small because each enquiry waits for you. One enquiry that fails is skipped while the rest are still handled, and the run is marked as failed with a note naming it.
You need a Gmail connection and an Anthropic connection, a Gmail search that finds your support mail, and a short description of what your company does, the tone to write in and anything a reply must never promise.
supportQuery to blank.Set supportQuery to blank.businessContext to blank.Set businessContext to blank.maxEmails to 5.Set maxEmails to 5.handledLabel to Reply handled.Set handledLabel to Reply handled.awaitingLabel to Reply awaiting approval.Set awaitingLabel to Reply awaiting approval.openQuery to (supportQuery) -label:handledLabel with replaced by - in lowercase -label:awaitingLabel with replaced by - in lowercase.Set openQuery to (supportQuery) -label:handledLabel with replaced by - in lowercase -label:awaitingLabel with replaced by - in lowercase.openQuery. Save it as inbox.List emails matching openQuery. Save it as inbox.failures to an empty list.Set failures to an empty list.enquiry in inbox.emails:For each enquiry in inbox.emails:claimed to false.Set claimed to false.delivered to false.Set delivered to false.replyErrorIf a step below fails, save the error as replyErroropenQuery. Save it as stillOpen.List emails matching openQuery. Save it as stillOpen.id of each item in stillOpen.emails doesn't contain enquiry.idIf the id of each item in stillOpen.emails doesn't contain enquiry.idenquiry.id as text: another run has already taken it on, or it was read meanwhile.Show in the output: Skipping the enquiry enquiry.id as text: another run has already taken it on, or it was read meanwhile.awaitingLabel to email enquiry.Add label awaitingLabel to email enquiry.claimed to true.Change claimed to true.sender to enquiry.from.Set sender to enquiry.from.subject to enquiry.subject.Set subject to enquiry.subject.question to enquiry.body.Set question to enquiry.body.prompt to You are writing a reply to a customer support email. Write only the body of the reply - no subject line, no salutation placeholders like [Name], and nothing you cannot verify from the context below. If the enquiry cannot be answered from that context, write a short reply that acknowledges it and says a colleague will follow up.Set prompt to You are writing a reply to a customer support email. Write only the body of the reply - no subject line, no salutation placeholders like [Name], and nothing you cannot verify from the context below. If the enquiry cannot be answered from that context, write a short reply that acknowledges it and says a colleague will follow up.
About the business:
businessContext
The customer wrote:
From: sender
Subject: subject
question.prompt. Save it as written.Ask Claude: prompt. Save it as written.
Maximum response length: 800written.response_text and save it as replyBody.Trim written.response_text and save it as replyBody.replyBody isn't emptyIf replyBody isn't emptysender about @subject? Save it as review.Request approval: Send this reply to sender about @subject? Save it as review.Approve and it goes to the customer now, as a reply in their own email conversation. Reject it, or leave it, and it is saved as a Gmail draft in that conversation for you to edit.
WHAT THE CUSTOMER WROTE
From: sender
Subject: subject
question
...review.approved is yesIf review.approved is yesenquiry.Reply to email enquiry.replyBodyenquiry.Draft a reply to email enquiry.replyBodydelivered to true.Change delivered to true.handledLabel to email enquiry.Add label handledLabel to email enquiry.@subject from sender: the AI wrote no reply. It is tried again next hour. to the end of failures and save it as failures.Add @subject from sender: the AI wrote no reply. It is tried again next hour. to the end of failures and save it as failures.awaitingLabel from email enquiry.Remove label awaitingLabel from email enquiry.delivered is yesIf delivered is yes@enquiry.subject from enquiry.from: the reply was sent or saved as a draft, but its labels could not be updated (replyError.message). It keeps the 'Reply awaiting approval' label so it is not answered twice; change that label to 'Reply handled' in Gmail. to the end of failures and save it as failures.Add @enquiry.subject from enquiry.from: the reply was sent or saved as a draft, but its labels could not be updated (replyError.message). It keeps the 'Reply awaiting approval' label so it is not answered twice; change that label to 'Reply handled' in Gmail. to the end of failures and save it as failures.retryNote to It is tried again next hour..Set retryNote to It is tried again next hour..claimed is yesIf claimed is yesreleaseErrorIf a step below fails, save the error as releaseErrorawaitingLabel from email enquiry.Remove label awaitingLabel from email enquiry.retryNote to It keeps the 'Reply awaiting approval' label, so it is skipped until you take that label off in Gmail..Change retryNote to It keeps the 'Reply awaiting approval' label, so it is skipped until you take that label off in Gmail..@enquiry.subject from enquiry.from could not be handled (replyError.message).@retryNote to the end of failures and save it as failures.Add @enquiry.subject from enquiry.from could not be handled (replyError.message).@retryNote to the end of failures and save it as failures.failures isn't emptyIf failures isn't emptyfailures with "Join failures with
- and save it as failureList.failureList.