Loading
Loading
  • Home

  • Automation with Zapier

  • Zapier tutorials

Zapier tutorials

7 min read

How to build an analysis assistant with ChatGPT

By Elena Alston · November 28, 2023
ChatGPT and Slack logos on a blue background

I'm terrible with numbers. Unfortunately, a big part of being a writer is knowing how to analyze blog metrics. Identifying which articles drive the highest engagements, activations, and upgrades can determine a lot about what I should be writing and whether or not I'm hitting those targets. 

Fortunately for me, ChatGPT can help. One of the best things about it is that it can analyze complex performance data (like those pesky numbers)—then explain it to me in a way I actually understand. 

Even better, when you pair ChatGPT with Zapier you can create an analysis assistant that connects to other apps you use. With a Zap—Zapier's automated workflows—you can automatically send Gmail attachments to ChatGPT for analysis, then receive a performance report in Slack. 

New to Zapier? It's workflow automation software that lets you focus on what matters. Combine user interfaces, data tables, and logic with 6,000+ apps to build and automate anything you can imagine. Sign up for free.

Before you begin

Make sure you set up a free OpenAI account before getting started. Once you've opened your account, head over to https://platform.openai.com/api-keys.  

Then, click the + Create new secret key button to generate your API key. Make sure to copy the key while you're here. You'll need it later when connecting your OpenAI account to Zapier.

Screenshot of API keys in OpenAI

You'll also need to create your assistant within OpenAI. To do this, head over to https://platform.openai.com/assistants. This is where all the assistants you create are stored, including the assistant ID, instructions, and date created. To create a new assistant, click +Create in the top-right corner. 

Screenshot of create assistant button

Now it's time to configure your assistant. For the focus of this tutorial, I want to create an expert analysis assistant that can analyze important performance data related to my fictional blog, A day in the life of Winston. But you could also set up an assistant that analyzes all sorts of data, like KPIs, sales performance metrics, or website traffic metrics. 

Give your assistant a name, like so: 

Screenshot of assistant name

Next, you should provide it with the specific instructions relevant to its role. 

In my case, I will instruct my assistant to analyze things like page views, unique visitors, sign-ups, and activations. I'll also tell it to identify the most engaging content, determine which are the top pieces that drive activations and sign-ups, and to analyze the efficacy of the SEO strategies in place. 

Here's my example: 

Screenshot of assistant instructions

Next, select the OpenAI model you want to use. Because we'll be using the file retrieval tool, we'll select gpt-4-1106-preview

Note: The Retrieval tool requires gpt-3.5-turbo-1106 or gpt-4-1106-preview models.

Screenshot of ChatGPT model

Under Tools, you can select either a code interpreter or a retrieval function. The retrieval function allows your assistant to respond to users' questions with knowledge from documents or files you upload. The code interpreter function allows your assistant to analyze complex data, like from a CSV file. However, because my file will be in a PDF format, I'll enable the retrieval function.

Screenshot of assistant tools

Finally, you can upload the files to your assistant's knowledge base by clicking Add file. Because I'll be uploading the file directly from Gmail in my Zap, I won't need to add any files here. But you could, for example, add any files that explain your company's ideal KPIs or performance targets, so that your assistant has more context when analyzing the file you upload in your Zap. 

Build an analytics assistant to analyze data

With Zapier, you can create automated workflows (we call them Zaps) that send information between different apps. You can create a Zap from scratch or use a template to get started quickly. 

Getting started with a template is easy. Click on the Zap template below, which will take you to the Zap editor. You'll be prompted to create a Zapier account if you don't have one already. Once that's done, just follow the instructions below to set up your Zap.

Analyze data and metrics from Gmail attachments with ChatGPT and send to Slack

Analyze data and metrics from Gmail attachments with ChatGPT and send to Slack
  • Gmail logo
  • ChatGPT logo
  • Slack logo
Gmail + ChatGPT + Slack

Multi-step Zaps—available on our paid plans—allow you to add multiple actions, filters, and even branching logic so you can do more, automatically. Learn how to use multi-step Zaps.

Set up your Gmail trigger

Time to set up your trigger—the event that starts your Zap. Choose Gmail for your trigger app and New Attachment as your event. If you're using the Zap template, this will already be selected for you.

Screenshot of Gmail event and app

Connect your Gmail account if you haven't already. Click on Choose an account… and click + Connect a new account, or select an account from the dropdown menu if you've connected Gmail to Zapier before. Click Continue

Next, select which label or mailbox you'd like your Zap to trigger on. 

Keep Inbox and All Labels selected if you want every email you receive to be checked for attachments. In my case, however, I only want it to trigger on emails labeled "blog performance", a label I previously set up in Gmail. 

Screenshot of trigger set up

Leave Search String blank if you've set up an email label. Otherwise, enter any text you want to include (like from: David or subject: KPIs). 

Click Continue. 

Now you need to test your trigger. Zapier will find a recent email in your Gmail account that matches the label or inbox you selected earlier. If you don't have any email that matches the specifications you selected, you should send one to yourself now. This will be used to set up the rest of your Zap.

Click Test trigger. You should see a selection of recent emails in your inbox. Select a test record, then click Continue with selected record.

Screenshot of test sample data

Set up your ChatGPT action

Now let's set up your action—the event your Zap will perform once it's triggered. Choose ChatGPT as your action app and Upload File as your action event. This action is what will upload your Gmail attachment to OpenAI—and your assistant. If you're using the Zap template, this will already be selected for you. Click Continue.

Screenshot of ChatGPT action set up

Next, a pop-up window will appear asking for the OpenAI API key that you copied earlier. Paste it into the API Key field, and click Yes, Continue to ChatGPT.

Screenshot of ChatGPT access

Now it's time to set up your action. You can pull data from your Gmail step by clicking inside the File field and picking an option from the Insert Data dropdown. In our case, we'll want to pull in the Gmail attachment file and the file name, so we can easily find it later on.  

Under Purpose, select assistants from the dropdown, so the Zap knows it will need this file in the next step. 

Screenshot of file attachments in ChatGPT

Click Continue

Next, you'll test your action. Click Test & Review or Test & Continue, and Zapier will upload the file to ChatGPT. 

Screenshot of ChatGPT test step

If you're not using the Zap template, click the + button below your action step. 

Screenshot of extra step icon

Set up your second ChatGPT action

Now let's set up the second action. Choose ChatGPT as your action app and Conversation with Assistant as your action event. If you're using the Zap template, this will already be selected for you. Click Continue.

Screenshot of ChatGPT second action

Once again, connect your OpenAI account and click Continue.

Now it's time to set up your action. You can pull in data from your previous steps by clicking inside the Message field and picking an option from the Insert Data dropdown. In our example, I'll type in a brief description of what I want it to do and the file's name for context:

Screenshot of file name in ChatGPT step

Now it's time to select the assistant you previously set up in OpenAI. Click inside the Assistant field and pick the right one from the Insert Data dropdown.

Screenshot of assistant selection

Leave the fields Assistant Name, Assistant Instructions, and Model blank, as you've already configured this information within OpenAI. You'd only fill out these fields if you want to create a new assistant every time your Zap runs or if you want specific instructions to override the existing assistant you created in OpenAI. 

Next, under Tools, select the Retrieval functionality from the dropdown.

Screenshot of tool selection in ChatGPT

Now scroll down to the Existing Files field. Here you'll want to pull in the data file pulled in by your previous ChatGPT step. Click inside the field and select your uploaded file from the dropdown menu. 

Screenshot of Winston file upload

Once you've finished customizing these fields, click Continue

Next, you'll test your action. Click Test & Review or Test & Continue, and Zapier will pull the response from your assistant according to how you customized your instructions. 

Screenshot of test sample

Finally, click on the +icon beneath your second action step. 

Screenshot of plus icon in Zap

If you're using the Zap template, this will already be added for you.  

Set up your Slack action

Now, you'll set up the step that sends your ChatGPT response to Slack. Choose Slack for your action app and Send Direct Message for your action event. Again, if you're using the Zap template, this will be set up for you.

Screenshot of Slack action app

You'll be asked to connect your Slack account. Connect the Slack account where you want the message to be posted. 

Click Continue.

Now it's time to set up how the message from your ChatGPT assistant will look in Slack and where it'll be posted. 

In my case, I want to set up a direct message that gets sent directly to myself (and no other users), so I'll select No under Send Multi Message. Under To Username, select your Slack username from the dropdown menu. 

Screenshot of Slack action set up

Add any other context you want to the Message Text field, and make sure to include Full Response from the data dropdown, as that contains your response from ChatGPT.

Screenshot of message text field

You can also customize where the message comes from, such as from a bot or yourself. If you choose a bot, you can customize things like the bot name and the icon that appears next to it.

Screenshot of Slack message set up

You can also include a link to the Zap, attach an image by URL, auto-expand links, and link usernames and channel names. 

Once you've customized your message, click Continue

Now it's time to test your action. Click Test action. Zapier will send you a direct message in Slack to make sure your Zap is working.

Screenshot of Slack message test

If everything looks good with your Slack message, then your Zap is ready to use. If something looks off or your test fails, go back and adjust until your message looks how you'd like it to.

Screenshot of analysis report in Slack

Bring the power of AI-assisted analysis into your workflows

Now, whenever you receive a new email attachment in Gmail, your Zap will send it straight to ChatGPT for analysis. Finally, you'll receive a full breakdown of the numbers—that make actual sense—directly in Slack. 

Building assistants in your Zaps lets you get a detailed overview of previously murky areas, helping you identify patterns to improve performance over time. What's not to love?

Related reading:

Get productivity tips delivered straight to your inbox

We’ll email you 1-3 times per week—and never share your information.

tags
mentioned apps

Related articles

Improve your productivity automatically. Use Zapier to get your apps working together.

Sign up
A Zap with the trigger 'When I get a new lead from Facebook,' and the action 'Notify my team in Slack'