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
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 replyErrorTry
openQuery. 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.idYes
enquiry.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.No
No steps
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 emptyYes
sender 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 yesYes
enquiry.Reply to email enquiry.replyBodyNo
enquiry.Draft a reply to email enquiry.replyBodydelivered to true.Change delivered to true.handledLabel to email enquiry.Add label handledLabel to email enquiry.No
@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.On error
delivered is yesIf delivered is yesYes
@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.No
retryNote to It is tried again next hour..Set retryNote to It is tried again next hour..claimed is yesIf claimed is yesYes
releaseErrorIf a step below fails, save the error as releaseErrorTry
awaitingLabel from email enquiry.Remove label awaitingLabel from email enquiry.On error
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..No
No steps
@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 emptyYes
failures with "Join failures with
- and save it as failureList.failureList.No
No steps