Ben's Bites
← Back
.md

Build an intelligent email reply system using Zapier

Create an automated email responder in minutes using Zapier and OpenAI.

intermediate pro
Tool: ZapierTool: OpenAI Topic: EmailTopic: Automation

2024-12-20

Email management can be a significant time sink for professionals and businesses alike. While automated responses can help, they often lack the personal touch needed for effective communication. This tutorial introduces a solution that combines the efficiency of AI with the nuance of human oversight.

Whether you're an entrepreneur looking to scale customer interactions, a busy professional aiming to streamline communications, or anyone seeking to optimize their email workflow, this tutorial will equip you with a powerful tool to transform your email management process.

This method ensures that no email is sent without your review, maintaining the perfect balance between efficiency and personal touch.

In this tutorial, you will learn how to:

  • Capture incoming emails using Zapier
  • Generate AI-drafted replies with Anthropic's API
  • Store email data and AI responses in a Zapier table
  • Implement a one-click review and send mechanism

Let’s get to it!

Step 1: Setting up your Zapier account and creating a custom table

First we’re going to create a custom table to store our email data. To do this, go to https://tables.zapier.com/app/tables, log in and click on the "Start blank" button to start a new table.

__wf_reserved_inherit

Select "Blank table" from the menu options. Name your table "Auto Email Responder" (or any name you prefer). Click "Create table" to finalize.

__wf_reserved_inherit

With your table created, let's add the necessary fields to store our email data:

1. Right-click on the first field (likely named "Field1") and select "Edit field".

2. Rename it to "Email" and set the field type to "Email".

__wf_reserved_inherit

3. Click "Save" to confirm the changes.

4. Repeat this process to add the following fields:

  1. Name (Text)
  2. Subject (Text)
  3. Email Body (Long Text)
  4. Time (Date and Time)
  5. Draft Reply (Long Text)

Take your time to ensure all fields are set up correctly. These will be crucial for organizing our email data effectively.

__wf_reserved_inherit

Great job! You've now set up the foundation for our AI-powered email reply system. In the next step, we'll create our first Zap to start capturing email data.

Step 2: Creating your first Zap

Now that we have our table ready, let's set up the automation that will capture incoming emails and generate AI-drafted replies.

Use Zapier AI to create a base template

Before setting up the trigger manually, let's use Zapier's AI feature to create a base template for our Zap:

1. Go to the Zapier homepage at https://zapier.com/app/home.

2. On the homepage, you'll see a Beta feature for creating Zaps with Zapier's AI. Look for a text input field at the top of the page.

__wf_reserved_inherit

3. In this field, enter the following prompt:

Create a Zap that triggers on new emails from [EMAIL_PROVIDER], sends the email content to Anthropic API for reply generation, and then creates a record in a Zapier Table.

Replace [EMAIL_PROVIDER] with your email service (e.g., Gmail, Outlook).

4. Click on the "Try it" button next to the prompt.

5. Zapier's AI will generate a basic template for your Zap. This will give us a good starting point to build upon.

__wf_reserved_inherit

Review and customize the AI-generated template

Review the Zap template created by Zapier's AI. Note that Zapier may use its native email app for the trigger. You can change this to your specific email provider in the next step.

Set up the trigger

Now, let's customize the trigger to use your specific email provider.

__wf_reserved_inherit

Click on the first step of the Zap (the trigger step). In the "App" section, search for and select your email provider (e.g., Gmail, Outlook).

💡 Tip: In our case, Gmail was used by default in the first step, so no changes were necessary.

In the "Event" section, choose the specific trigger event. For this tutorial, we'll use "New Email" as our trigger. You may see other options like:

  • New Email Matching Search
  • New Label
  • New Labeled Email
  • New Starred Email

Choose the option that best fits your needs. For simplicity, we'll stick with "New Email".

__wf_reserved_inherit

Click "Continue" to proceed.

Configure email account

If you haven't connected your email account to Zapier before, you'll be prompted to do so now. Click on "Sign in" and follow the authentication process for your email provider.

Grant Zapier the necessary permissions to access your email account.

__wf_reserved_inherit

Customize trigger settings

Once your account is connected, you'll see options to customize your trigger settings. Choose the specific mailbox or label you want to monitor (e.g., Inbox, Important).

If desired, you can add filters to only trigger the Zap for specific types of emails.

__wf_reserved_inherit

Test the trigger

Before moving on, it's crucial to test our trigger to ensure it's working correctly:

  1. Click on the "Test trigger" button.
  2. Zapier will fetch recent emails from your account. Select one of these emails for testing purposes.
  3. Review the data pulled from the email to ensure it's capturing all the information we need.
__wf_reserved_inherit

Step 3: Integrating Anthropic's API

Now that our Zap can detect new emails, let's set up the AI that will draft our replies.

Connect your anthropic account

To use Anthropic's AI, we need to connect your account. If you don't have an Anthropic account yet, head to https://console.anthropic.com and sign up.

__wf_reserved_inherit

Once logged in, navigate to https://console.anthropic.com/settings/keys to find your API keys. Click "Create Key", name it "Zapier Auto Responder Key", and copy the generated key.

__wf_reserved_inherit

Back in Zapier, click "Sign in" in the Anthropic account section and paste your API key.

Configure anthropic AI settings

Now, let's set up the prompt that will guide the AI in drafting replies. In the "System Instructions" field, paste one of the following prompts based on your use case (replace the placeholders in square brackets with your specific information):

A. For personal email management:

You are an AI assistant helping to draft email replies for [YOUR_NAME]. Use the following information to personalize responses:

Personal Details:Age: [YOUR_AGE]
Location: [YOUR_LOCATION]
Occupation: [YOUR_OCCUPATION]
Hobbies: [YOUR_HOBBIES]
Family status: [YOUR_FAMILY_STATUS]

Communication Style:
Preferred tone: [FORMAL/CASUAL/FRIENDLY]
Writing style: [CONCISE/DETAILED/HUMOROUS]
Language preferences: [ANY_SPECIFIC_LANGUAGE_REQUIREMENTS]

Response Guidelines:
Keep replies brief, maximum 2 paragraphsAlways maintain a [POLITE/PROFESSIONAL/FRIENDLY] demeanorInclude personal touches when appropriateAvoid oversharing personal informationSign off with [YOUR_PREFERRED_SIGNATURE]

Additional Context:
[ANY_OTHER_RELEVANT_PERSONAL_INFORMATION]

When drafting a reply, first analyze the incoming email for tone and content. Then, craft a response that aligns with the above guidelines and feels authentic to [YOUR_NAME]'s personality. Do not include explanations or meta-commentary about the response. Please don't give any subject in your response, directly send body of the mail. It would be directly sent to sender.

Draft a suitable reply.

B. For business email management:

You are an AI assistant drafting email replies for [COMPANY_NAME]. Use the following information to create appropriate responses:

Company Information:
Industry: [COMPANY_INDUSTRY]
Size: [COMPANY_SIZE]
Main products/services: [MAIN_OFFERINGS]
Target audience: [TARGET_AUDIENCE]
Company values: [COMPANY_VALUES]

Communication Guidelines:
Brand voice: [PROFESSIONAL/FRIENDLY/AUTHORITATIVE]
Tone: [FORMAL/SEMI-FORMAL/CASUAL]
Key messages to emphasize: [KEY_BRAND_MESSAGES]

Response Parameters:
Keep replies concise, maximum 2 paragraphsAlways maintain a [PROFESSIONAL/HELPFUL/EMPATHETIC] demeanorInclude relevant product/service information when appropriateAvoid making promises or commitments without approvalSign off with [COMPANY_SIGNATURE]

Additional Business Context:[ANY_OTHER_RELEVANT_BUSINESS_INFORMATION]

When crafting a reply, first analyze the incoming email for intent and urgency. Then, compose a response that aligns with the above guidelines and represents [COMPANY_NAME]'s brand voice accurately. Do not include explanations or meta-commentary about the response. Please don't give any subject in your response, directly send body of the mail. It would be directly sent to sender.

Draft a suitable reply:

Set up email input for AI

Now, let's provide the AI with the incoming email content. In the "User message" field, use the following prompt template:

New email received:
From: {{From Name}}
Subject: {{Subject}}
Email Content:
{{Body Plain}}

Please draft a suitable reply based on the above email and the provided system instructions.

Use the Zapier interface to map the correct fields from your email trigger to each placeholder.
__wf_reserved_inherit

Configure advanced AI settings

To fine-tune the AI's output:

  1. Expand the "Show advanced options" section.
  2. Set "Max tokens" to 300-400 to limit the length of the AI's response.
  3. Leave other advanced settings at their default values for now.
__wf_reserved_inherit

Test the Anthropic AI step

Before moving on, let's make sure our AI is generating appropriate responses:

1. Click on the "Test step" button in the Anthropic action.

2. Review the AI-generated reply in the "Response content text" field.

__wf_reserved_inherit

3. If the reply doesn't meet your expectations, adjust your system instructions and test again.

Great job! You've now integrated Anthropic's Claude AI into your Zap. In the next step, we'll store this information in our Zapier table.

Step 4: Storing email data in Zapier table

Now that we have our AI-generated reply, let's store all this information in the Zapier table we created earlier. In the "Table" dropdown, select the "AI Drafted Email Replies" table we created earlier.

__wf_reserved_inherit

For each field in the table, map the corresponding data from previous steps:

  • Email: Select the sender's email from the trigger step
  • Name: Select the sender's name from the trigger step
  • Subject: Select the email subject from the trigger step
  • Email body: Select the email body from the trigger step
  • Time: Select the received time from the trigger step
  • Draft reply: Select the "Response content text" from the Anthropic step
__wf_reserved_inherit

Click on the "Test step" button in this action - review the created record to ensure all information is correctly stored.

Excellent! You've now set up a system that captures incoming emails, generates AI-drafted replies, and stores all this information in a Zapier table. In the next step, we'll create a mechanism for reviewing and sending these replies.

Step 5: Creating a review and send mechanism

To ensure quality control, we'll create a button in our Zapier table that triggers a review process before sending the AI-drafted reply.

In the Zapier table, you will find the first column for button, right-click on the "Click this to run a Zap" column header. Select "Edit field" and go to the "Zaps" tab.

__wf_reserved_inherit

Click "Create" to start a new Zap. In the new Zap, you'll see that the trigger is already set to "Button Clicked in Zapier Tables". Confirm that the correct table and button are selected.

__wf_reserved_inherit

Click the "+" button to add an action to this Zap. Search for and select your email provider (e.g., Gmail, Outlook). Choose "Send Email" as the action event.

__wf_reserved_inherit

In the "To" field, select the "Email" field from your Zapier table. For the "From" field, choose your email address. In the "Subject" field, use the template "Re: {{Subject Line}}", mapping the subject from your table. In the email body, select the "Draft Reply" field from your table.

__wf_reserved_inherit

Run tests for both Zaps to ensure they're working correctly.

If everything looks good, turn on both Zaps to activate your AI-powered email reply system.

__wf_reserved_inherit

Congratulations! You've successfully set up an AI-powered email reply system with a human review process. This system will capture incoming emails, generate AI-drafted replies, store them in a table for your review, and allow you to send them with a single click.

Step 6: Fine-tuning and best practices

Now that your system is up and running, here are some tips to get the most out of it:

Regularly review and refine AI prompts

The quality of your AI-generated replies depends largely on the instructions you provide. Regularly review and refine your prompts based on the responses you're getting. Don't hesitate to add more context or guidelines if you notice consistent issues with the AI's replies.

Monitor and adjust token limits

If you find that the AI's responses are consistently too long or too short, adjust the max token setting in the Anthropic action. Start with 300-400 tokens and adjust as needed.

Implement a quality control process

While the AI is impressive, it's not infallible. Implement a process to regularly review a sample of AI-drafted replies to ensure they maintain the desired quality and tone.

Customize for different email types

Consider creating multiple Zaps for different types of emails (e.g., customer support, sales inquiries, personal correspondence). This allows you to tailor the AI's instructions more specifically to each type of communication.

Maintain a human touch

Remember, while this system can greatly increase your efficiency, it's important to maintain a human touch in your communications. Use the AI-drafted replies as a starting point, but don't hesitate to personalize them further when needed.

This tutorial was created by Tanmay.

Upgrade to Pro

This tutorial contains Pro content. Upgrade to access the full tutorial and all Pro features.

Get Pro Access