Quick Overview
This workflow polls Gmail for unread emails labeled “support”, uses Google Gemini to draft a concise reply, and posts it to Slack for human approval; approved drafts are sent via Gmail and logged to Google Sheets, while discarded drafts are logged without sending.
How it works
- Checks Gmail every minute for unread emails that match the query
label:support.
- Sends the email sender, subject, and body to Google Gemini to generate a one-line summary and a suggested support reply.
- Formats the draft with the original email metadata (recipient, subject, thread/message IDs) and a fallback reply if needed.
- Posts the proposed reply to a Slack channel with “Send it” and “Discard” buttons and waits for an approver’s decision.
- If approved, sends the reply from Gmail with the subject prefixed by “Re:” and then appends a record to a Google Sheets “Replies” tab.
- If declined, appends a record to the same Google Sheets “Replies” tab to log that the draft was discarded.
Setup
- Connect credentials for Gmail OAuth2, Google Gemini (PaLM) API, Slack OAuth2, and Google Sheets OAuth2.
- Ensure support emails in Gmail are labeled
support and arrive as unread so they match the trigger query.
- Select the Slack channel that should receive approval requests (for example,
#support-approvals).
- Choose the target Google Sheets document and ensure it contains a sheet/tab named “Replies” for logging outcomes.