Automated Email Reply Drafts Agent
Every new inbox email gets a draft reply in your own tone, with meeting times from your calendar and web research where needed, ready for you to review and send.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/create-automated-email-reply-drafts-in-gmail/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Personal Productivity · Email management
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/create-automated-email-reply-drafts-in-gmail
Set it up with the CLI
- Add it. Copies the folder into
zaps/create-automated-email-reply-drafts-in-gmail/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/create-automated-email-reply-drafts-in-gmail - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy create-automated-email-reply-drafts-in-gmail - Check it. Its recent runs, with status and errors.
npx zap-pack logs create-automated-email-reply-drafts-in-gmail
zaps/create-automated-email-reply-drafts-in-gmail/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 1 to fill in
- connections/gmail.tsThe
gmailaccount it uses - connections/google-calendar.tsThe
google-calendaraccount it uses - triggers/message.tsWhat starts it:
gmailmessage - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a new email arrives in the inbox (
gmail,message). - Gmail finds recent sent mail, to sample the user's tone and sign-offs.
- Google Calendar lists the events in the next few weeks, to offer meeting times.
- AI by Zapier reads the email, the sent-mail sample and the calendar, searches the web for the sender or a resource when that helps, and writes the reply. It returns
NO_REPLYfor automated mail such as invitations and receipts, and politely declines sales pitches. - Gmail creates a draft reply in the email's thread. Nothing is sent. The user reviews each draft and sends it themselves.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | What goes there |
|---|---|
CALENDAR_ID |
The calendar that shows the user's availability, usually their own email address: ask which one, then look it up with the user's Google Calendar connection |
Also review the defaults with them:
SENT_MAIL_QUERY: the Gmail search for sent mail used as a writing sample.in:sentis the default.CALENDAR_LOOKAHEAD: how far ahead the calendar is read for meeting times.+2 weeksis the default.MEETING_TIME_ZONE: the time zone for proposed meeting times.America/Chicagois the default; change it to the user's own zone.MODEL_ID: the model tier for the AI step.premium/autois the default.label_ids(trigger,triggers/message.ts): the mailbox that starts the Zap.INBOXis the default.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/create-automated-email-reply-drafts-in-gmail, replace each REPLACE_… value as this file says, then run npx zap-pack deploy create-automated-email-reply-drafts-in-gmail, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
gmailto the user's Gmail connection, andgoogle-calendarto their Google Calendar connection. The AI step needs no connection; it uses AI by Zapier's managed model credentials (authentication_id: "0"). - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/message.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyismessage, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. For the AI step's configuration, readget_zapier_skill("zapier:ai-by-zapier"). - Fields: inspect the trigger's output fields and the actions' fields with the user's connections before the first test run. Fix any key in
workflow.tsthat doesn't match. The actions it uses aregmailmessage(search),google-calendarevent_v2(search),aiget_completion(write) andgmaildraft_v2_reply(write).
Test it
Run this sample as a draft test (run_workflow_draft in Zapier MCP), using a test email the user sent to themselves for this, not a real one:
{
"message_id": "18c0example",
"subject": "Lunch next week?",
"snippet": "Are you free for lunch on Tuesday or Wednesday?",
"body_plain": "Hi, are you free for lunch on Tuesday or Wednesday? Let me know what works.",
"from": { "name": "Test Sender", "email": "test@example.com" }
}
Confirm that a draft reply appears in the thread of that test email, in the user's tone, with meeting times that match their calendar. Nothing should have been sent. If run-status tools aren't available, check the draft in Gmail directly. The user deletes the test draft, not the agent.
Notes
- The Zap only creates drafts. It never sends mail, changes labels or deletes anything. The user sends each reply.
- The AI step can search the web and read pages through AI by Zapier's
web_searchandweb_scrapetools. Those reads happen on every run that drafts a reply, so they add cost and time. - Gmail's Find Email step returns the messages it matches for
SENT_MAIL_QUERY. Its voice sample is only as good as what that search returns. - Gmail sender addresses and calendar contents are sent to the AI step on each run. Keep the calendar limited to the calendar the user wants shared with the model.
- Never commit a real calendar ID or a real sender address into this folder.