How to Connect ChatGPT to Gmail: A GPT Actions Guided Example

A GPT is a customizable variant of ChatGPT that can carry out certain tasks or enhance its capabilities in specialized fields. Think of GPT Actions as superpowers for GPTs, enabling them to engage with external sources and services, which goes beyond mere text generation. In this post, we’ll walk you through the process of linking your GPT to Gmail via the Zapier AI Actions OpenAPI API. This will make it possible to search your Gmail inbox, get email summaries from ChatGPT, or even allow it to send emails for you.

This post’s primary objective is to demonstrate the Action feature of personalized GPTs. Just like the Knowledge feature, which lets you upload documents to your GPT, GPT Actions are a fascinating enhancement to ChatGPT because they evolve your GPT into an AI agent. This agent can not only respond to inquiries but also conduct tasks online. Virtually any task that relies on internet services accessible via an API can be set up as a GPT Action.

At the present, in order to generate a GPT, it’s required that you hold a ChatGPT Plus subscription, coming at a monthly cost of $20. Additionally, you’d also need to maintain a Zapier account. Zapier is an online tool for automation, designed to bind different web applications together and automate the workflow between them. The complimentary plan offered by Zapier is sufficient for this guide.

Create a GPT for Gmail

Once you sign in to your ChatGPT account, head over to the GPT page and click the Create button.

For this guide, you only need to name your GPT and fill out the fields discussed below. Scroll down to the Instruction field and paste this text:

###Rules:

- Before running any Actions tell the user that they need to reply after the Action completes to continue.

- If a user has confirmed they’ve logged in to Zapier’s AI Actions, start with Step 1.

###Instructions for Zapier Custom Action:

Step 1. Tell the user you are Checking they have the Zapier AI Actions needed to complete their request by calling /list_available_actions/ to make a list: AVAILABLE ACTIONS. Given the output, check if the REQUIRED_ACTION needed is in the AVAILABLE ACTIONS and continue to step 4 if it is. If not, continue to step 2.

Step 2. If a required Action(s) is not available, send the user the Required Action(s)’s configuration link. Tell them to let you know when they’ve enabled the Zapier AI Action.

Step 3. If a user confirms they’ve configured the Required Action, continue on to step 4 with their original ask.

Step 4. Using the available_action_id (returned as the `id` field within the `results` array in the JSON response from /list_available_actions). Fill in the strings needed for the run_action operation. Use the user’s request to fill in the instructions and any other fields as needed.

REQUIRED ACTIONS:

- Action: Gmail Add Label to Email

- Action: Gmail Send Email

- Action: Gmail Create Draft Reply

- Action: Gmail Reply to Email

- Action: Gmail Create Draft

- Action: Gmail Create Label

- Action: Gmail Remove Label from Email

- Action: Gmail Find Email

As we are working with an AI, the instructions will be in natural language. The available Actions are listed below as REQUIRED_ACTIONS. These are modified instructions provided by Zapier.

Add the GPT Instructions for accessing the Zapier API

Scroll down to the end of the page and click Click new action.

Now click Import from URL and then paste this URL: https://actions.zapier.com/gpt/api/v1/dynamic/openapi.json?tools=meta

Import a Schema for a GPT Action

The Schema field will be filled with the OpenAPI JSON needed to access the Zapier AI API.

OpenAPI JSON for accessing the Zapier AI API

You canSave your GPT now. Make sure to select “only to me” before you publish the GPT. It’s likely that you don’t want to share your emails with the rest of the world.

Publish the GPT only for me

Publish the GPT only for me

Add GPT Actions in Zapier

Sign in to Zapier, open the GPT Actions page, and enable each Action as defined in the GPT instructions. In the search field, type “Gmail” and select an Action that you want to enable for your GPT.

Set up GPT Actions

Set up GPT Actions

You now have to connect Zapier with your Gmail account.

Connect Action with your Gmail account

In order to use Zapier, you need to provide access to your Gmail account.

Allow Zapier to access your Gmail account.

You have to repeat this procedure for each Action you want to enable for your GPT.

Enable GPT Action

Accessing Gmail from your GPT

You can now access Gmail through a Zapier API-enabled Action by signing in and confirming access with your Zapier account. To give you an idea of how a search with the help of an AI differs from a full-text search, here is a prompt I tried:

Me: Search for an email mentioning a conference with the participation of the pioneer or founder of artificial intelligence. I forgot his name.

ChatGPT: To locate the email you’re seeking, we can utilize the “Gmail: Find Email” feature. Please verify that you’re logged into Zapier’s AI Actions before we proceed. After receiving your confirmation, I’ll continue with the steps.

Me: Verified

ChatGPT: There are several emails that might relate to your search for a conference that includes a founder or pioneer in artificial intelligence. Here’s a brief overview:

Email titled “Introducing the 2024 ABUNDANCE Summit Faculty!”

Date: Wed, 10 Jan 2024

From: The Abundance360 Team (peter-at-diamandis.com)

To: Me

This email appears to be a formal introduction of faculty members for an incoming summit, which…

ChatGPT discovered the email of the ABUNDANCE Summit Faculty from Peter Diamandis. It features Geoffrey Hinton, a noteworthy figure in the field of AI research, known for his work in neural networks. His name is one I’ll never forget as he’s been my role model since my college years. I may be flirting with the boundaries of ethics by lying to an AI, but it’s a necessary move to make the prompt more challenging. Even though the term “conference” is what I used in the prompt, as opposed to “summit”, ChatGPT was capable of finding the email regardless, even without the word “conference” appearing in the said email.

Moreover, it’s possible to also send emails:

Me: Send an email to [email protected]. In the email, politely explain that I am unable to attend his summit because my dollars are not abundant. Additionally, please mention that my copilot advised against investing $10000-$25000 without knowing the specific object of investment. Choose an appropriate subject.

And this is the email ChatGPT has sent:

Dear Peter, I hope this email finds you well. I am writing to inform you that, regrettably, I will not be able to attend the upcoming ABUNDANCE Summit. As much as I would have loved to be a part of this exciting event, my financial situation does not allow for such an investment at the moment. Additionally, my financial advisor has recommended against investing an amount in the range of $10,000-$25,000 without a clear understanding of the specific object of the investment. I sincerely appreciate the invitation and hope to have the opportunity to participate in future events. Best regards, Michael

Sending an email with ChatGPT

The subject that ChatGPT has chosen made me feel goosebumps:

A GPT test email

Link

ChatGPT seemed to have figured out that I only wanted to send a test email

Conclusion

The Actions feature is the heart of customized GPTs. Despite its potential, I believe that customized GPTs are presently in the beta phase. During my testing phase, I encountered a number of strange problems. Some of which might have had their roots in the Zapier AI Actions API, presently in the Alpha phase. However, some issues were certainly tied to GPT. For example, the Action examples given by OpenAI did not function at all, leading me to question if they were thoroughly tested before rolling out.


Posted

in

, ,

by

Tags: