How To
Jun 30, 2023

How to Use Chat GPT for Email Marketing

If you are an email marketer, you must have already gone through numerous articles and social posts covering how to leverage ChatGPT in email marketing. You can do pretty much everything with it, from generating subject lines to entire copies for your newsletters and email campaigns.

Although ChatGPT makes it convenient to generate content, the method is not scalable. If you send personalized emails, you must enter prompts for each lead separately or modify the content at your end before using it.

But what if I told you there’s a much better way to use ChatGPT in email marketing that takes content automation to the next level. I’m talking about the OpenAI API.

In this blog, we will understand what OpenAI’s ChatGPT API is and how you can use it with Gigasheet's no-code custom enrichments to automate your workflow and scale your email marketing. So, let’s dive straight in.

OpenAI API Explained

API, short for Application Programming Interface, is a set of protocols that facilitate communication between different devices and programs. Similarly, the OpenAI API allows developers to integrate OpenAI’s natural language model with their applications.

Why should you use OpenAI API? - It makes it easier to access the GPT model and use it to create custom workflows and applications.  

When you use the OpenAI API, you can send a request to the OpenAI’s GPT server with input text. The server then processes this request and generates a response based on the input.

Without APIs like OpenAI API, one would have to code and train their own language model if their applications require NLP and content generation capabilities. The OpenAI API makes it easy for developers to integrate advanced language model into their applications to create useful features.

Check out OpenAI documentation to learn more about their API

Get Your OpenAI API Key

OpenAI API is a paid API with different models having different pricing. But you can create API keys for free, and you are charged for using those keys. New accounts also get a free trial with a $5 credit.

According to OpenAI: “Prices are per 1,000 tokens. You can think of tokens as pieces of words, where 1,000 tokens is about 750 words.”

Now to get your API keys, just follow these steps:

1. First, you must be a registered user of the OpenAI platform to get access to an API key. You can sign up for it here.

2. Once you have signed up and signed in to your OpenAI account, you can create new keys. Click the profile icon on the top right of your screen and select “View API Keys.”

OpenAI API platform homepage

3. You will see an option “Create New Secret Key.” Click it, name your API key, and save it.

Creation of new OpenAI API keys

4. Copy the key and paste it somewhere safe because you won’t be able to access it later in your OpenAI account.

Using OpenAI API with Gigasheet

We recently updated Gigasheet with new features and improved many existing features further. With Gigasheet, you can now use custom enrichments to pull data using any API on the Internet without coding or going through extensive setup process.

The custom enrichments feature allows us to request OpenAI’s GPT-3 language model and generate text based on our prompts. We can also use columns in our dataset to make prompts dynamic, something I’ll show you in a bit. As a result, we can generate unique text for multiple row entries with a single prompt.

Now let’s see Gigasheet and OpenAI API in action.

1. Upload your email list to Gigasheet

First of all, we need to upload an email list to Gigasheet. So, ensure you are logged in to Gigasheet and drag and drop your file to the library. If you do not have a Gigasheet account, create one here for free.

We will use a sample dataset with details like the lead’s name, email address, company, etc. It is a CSV file, but you can also use an XLSX file if that’s your preferred format to store email lists. Once the file is uploaded and processed, click to open it.

Datasets processed into rows and columns within Gigasheet.

2. Get OpenAI API cURL

Now we need to write a prompt to generate a personalized email intro and get OpenAI API’s cURL to create the ChatGPT enrichment. We can accomplish both of these tasks in the OpenAI Playground.

We will visit the OpenAI Playground webpage and write the following prompt:

Snapshot of OpenAI Playground

“name” will act as a dynamic entry where we will reference data from the name column in our dataset. Similarly, “company” references organizations’ names in the company column.

Next, ensure the Mode and Model options on your screen’s right side are set to Complete and text-DaVinci-003, respectively. Then, click the View Code option, select cURL from the drop-down menu, and click Copy to copy the cURL and prompt to the clipboard.

Creation of prompt and curl in OpenAI Playground

3. Create A Custom Enrichment for ChatGPT

Now that we have our email list open, we can move to create custom ChatGPT enrichment. Head over to the Functions tab in the menu bar, select Enrichments, and then select cURL.

Paste the cURL copied earlier in the textbox under the CURL REQUEST section. Edit the line -H “Authorization: Bearer $OPENAI_API_KEY” \ (replace $OPENAI_API_KEY with your OpenAI API key). And click Next.  

Gigasheet's custom enrichment

Now, we have ADD SHEET VALUES section in front of us. Here we will make some changes to the prompt to make it dynamic. Click and highlight “name,” select the first_name column, and click Insert Column Reference.

Similarly, highlight “company,” select the company column and click Insert Column Reference. And click Next.

Gigasheet's custom enrichment

Then, we will select the column that contains the email intro sentence generated by OpenAI’s GPT model, i.e., choices/0/text. Click Apply and then Run.

Wait for the processing to complete. Gigasheet will notify when it has pulled all AI-generated text from OpenAI’s GPT API.

4. Assess the Generated Content

If you did everything correctly till now, you should see a new column choices/0/text with email intro sentences for each lead. Every entry has mentioned the first name of the lead and their company, as we instructed in our prompt, but at the same time, the intro for each lead is unique.

Custom enrichments add a new column with data collected using APIs .

Similarly, you can repeat the steps and write prompts to generate personalized subject lines, CTAs, and other body content for your emails.

However, since issues of AI-generated content is far from being polished, it is advised that you should not use the content as it is. Instead, review AI generated text extensively and do modify the intro wherever you like.

You can edit the AI-generated text in Gigasheet as well. Simply double-click a cell and edit its content as you like. Then you can export your email list for using it in your CRM or email automation software.

Liked this blog? We have tested many different APIs with our custom enrichments. You can find more custom enrichment use cases on our Recap of No-code Gigasheet Data Enrichments.

Use Gigasheet to Leverage Big Data in Your Marketing

Custom enrichments in Gigasheet make data enrichments accessible to beginners and non-tech users. You saw how easy it is to generate text responses based on a single prompt at scale with a simple ChatGPT API enrichment.

But that is not all. Gigasheet is a full-fledged big data analytics tool. You can work with billions of rows of data, group and filter it, and fill gaps with custom enrichments without writing a single line of code.

Gigasheet is free to use for everyone, so sign up today!

The ease of a spreadsheet with the power of a database, at cloud scale.

No Code
No Database
No Training
Sign Up, Free

Similar posts

By using this website, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.