4. August 2023 · Reading Time: 7 min · By Mark Reinke

How I automated Email replies with Zapier and ChatGPT

TL;DR In this post, I will demonstrate how to harness the power of Zapier and ChatGPT for email automation. By extracting and structuring data from incoming emails, the process not only saves time but also creates a central hub for various automated workflows.

How to automate email replies

Combining Zapier with ChatGPT is very powerful as we can integrate the magic capabilities of ChatGPT into our everyday workflows and tools. I am going show you how I automated email replies for workshop registrations. I hope this can serve as template for many different variations of this use case that are relevant to you.

Here is the scenario:

We offer Generative AI Workshops for Prompt Engineering and Automation with ChatGPT. Participants register for our workshops through a form on our website. This triggers and email to us containing the information that the person filled in.

After receiving a registration email we send a confirmation to the person that has registered with all the information they need. As more and more people register for our workshop this takes up quite some time, so I decided to automate this process and send the email replies automatically.

A lot of processes start with an incoming email. For example we might want to classify an email and decide whether it’s relevant and must be answered. Or we might want to add the sender to other apps such as a CRM, Google Contacts or an invoicing app. All of these tasks can be automated using Zapier and ChatGPT. For this reason I chose to implement the workflow in a way that can be extended to many different tasks: First the information from the emails is stored in a Zapier Table. Then this table is used as a starting point for tasks that build on the extracted information.

For anyone too impatient to read the whole tutorial here are the key insights I learned:

  • Zapier Tables: A crucial part of the automation process is Zapier Tables. By storing the structured information extracted from emails in a Zapier Table, you can create a central hub from which to trigger multiple workflows. This not only automates email replies but also extends to a variety of tasks such as adding contacts to CRM or invoicing.
  • Structuring data with ChatGPT: To effectively automate, it’s necessary to structure the information from the emails. We use the Zapier integration of ChatGPT with its Extract Structured Data feature is used to transform unstructured text into usable data.
  • Lookup Table in Zapier Formatter: The lookup table feature in the Zapier Formatter can be used to automate the process of selecting different email templates based on the incoming email and to personalize email replies.

For every one that wants to make their hands dirty, here is a detailed tutorial on how to automate email replies:

The email automation workflow

Everytime I label an email with “workshop registration” a Zap is triggered that extracts the content of the email and transforms it into structured information that is stored in a Zapier table. This triggers another Zap that composes an email reply and stores it in my email outbox as a draft.

Step-by-step tutorial

Preliminaries

In order to setup automatic email replies the following is required:

Parse email information and store it in a Zapier table

Our objective is to store information from emails in a structured way, so that we can then build different workflows on top of this information, for example to write an email reply or to add contacts to a CRM. Zapier Tables is a great way to accomplish this, as it gives us a central point where we can view the gathered information and manage the connected workflows.

So our first Zap will extract and structure information from emails using ChatGPT and then store this information as a record in the table we set up.

Set up a Zapier Table to store structured information

We begin by setting up a Zapier Table that will store the information from emails in a structured way.

When the table is set up it’s time to create a Zap. Click on the Zap icon in the left sidebar, select “Automatically add records to this table from a form or app” and click Create Zap.

Configure a Zap to extract structured data from emails and store them in the table

We will now setup a Zap that is triggered everytime we label an email. It then extracts and structures information using the ChatGPT Action and stores the information in the Zapier Table. The finished Zap will look like this:

Trigger

We are going to trigger this Zap by labeling an email in Gmail with a specific label. To achieve this select Gmail (or another provider) as your trigger app, choose New Labeled Email as the event and choose the label you want to use from the Label/Mailbox list (if the label doesn’t exist yet you need to add it in Gmail first and then click Refresh fields). Test the trigger by labeling an email in your connected Gmail account.

Action: Extract structured data in ChatGPT

This is where the magic happens. In this step we utilize ChatGPT to transform the content of an email into a structured representation. The key idea here is to use ChatGPT’s Function Calling feature, which is provided in Zapier via the Extract Structured Data event. This allows unstructured continuous text to be converted into structured data. This data can then be used by other applications.

  • Select the ChatGPT app and the Extract Structured Data event
  • Connect your OpenAI account
  • In the Unstructured Text field select the content to be parsed: e.g. Subject and Body Plain
  • Select the model gpt-3.5-turbo-0613
  • Add a prompt under Description, e.g.: “Extract the workshop and participant information from text.”
  • Now select all fields that you want to extract

Action: Create Record in Zapier Tables

In the last step of the Zap you can now map all the fields extracted by ChatGPT to columns in the Zapier Table. Test the Zap and check if a new record has been added to the Zapier Table.

Create email replies from table records

Now that we have a table in which all our workshop participants are stored we can trigger all kinds of workflows automatically whenever a record is added. To configure these Zaps we again click on the Zap icon in the left sidebar, but this time we select “Trigger when new records are added to the table”.

This brings us to a newly created Zap that we will configure as follows:

Utilities in Formatter by Zapier

The first action is used to select an email template for our reply. We offer different workshops, so we want to choose a different template for each workshop. This can be done using the Zapier Formatter. This tool offers a lookup table which we can use to select a template based on the workshop name. We can also use it to insert values from the record into the email template. That way we can for example address the recipient by name and insert the correct date into the content.

Action: Create Draft in Gmail

In the very last step we create an email draft in Gmail. We could of course also send an email directly, but creating a draft provides a safety net so that we can check the correctness of the email before sending it.

We select the Gmail app and choose Create Draft as the event. Then we fill the fields in the Action section with the values from the preceding steps. Most importantly we set the To field to the email field from the table record and the Body to the output of the Formatter (the email template we configured).

Conclusion

Wrapping up, my journey of automating email replies for our workshops has been succesful. The integration of Zapier and ChatGPT not only relieved me from the time-consuming task of replying to each registration, but also opened the door to a whole new world of automated workflows. By capturing and structuring the incoming registration emails into a Zapier Table, I’ve created a central hub from which numerous tasks, like contact management and invoicing, can be automated. This approach allows us to focus on delivering quality workshops rather than juggling administrative tasks.

Contact us