This project allows you to automatically analyze email threads and their attachments using AI. When you forward an email to specific email address, Zapier will trigger a webhook that processes the content and sends back an AI generated response suggestion.
For more detailed setup guide, see the related blog post.
This application uses Resend to send emails and DeepSeek for LLMs. To run the application, you need the following environment variables in the .env
file.
DEEPSEEK_API_KEY=
QSTASH_TOKEN=
RESEND_API_KEY=
First, deploy your API endpoint that will receive the webhook from Zapier. The endpoint should be accessible at
https://<YOUR_VERCEL_DOMAIN>/analyze
You can also use ngrok
to setup a publicly accessible endpoint on your local. See local development guide
- Go to Zapier and click "Create Zap"
- Name your Zap (e.g., "Email Analysis Workflow")
- Choose "Gmail" as your trigger app
- Select "New Email" as the trigger event
- Connect your Gmail account if not already done. This email address will be the account you'll forward the emails to get the response suggestions.
- Optional: Add filters to only trigger on specific emails
- Add a new action step
- Choose "Webhooks by Zapier"
- Select "POST" as the action event
- Configure the webhook with these settings:
- URL: Your API endpoint (e.g.,
https://your-domain.com/api/analyze
) - Payload Type:
json
- Data:
{ "message": "{{body_plain}}", "subject": "{{subject}}", "to": "{{to_email}}", "attachment": "{{attachment_1}}", "attachment_type": "{{attachment_type}}" }
- Wrap Request in Array: No
- Unflatten: Yes
message
: Use Gmail's "Body Plain" fieldsubject
: Use Gmail's "Raw Payload Headers Subject" fieldto
: Use Gmail's "From Email" fieldattachment
: Use Gmail's "Attachment 1 Attachment" fieldattachment_type
: The type of the attachment, currently onlyapplication/pdf
is available on backend.
- Currently handles one attachment per email
- Supports PDF attachments
- Maximum email size limit based on your API endpoint's limitations