This article shows you how to add variables to a ChatGPT Prompt Template. Variables are an advanced feature that let you insert flexible inputs. The result is saved time and lots of different content (e.g. email campaigns, website content, or creating social media posts) with just a few clicks.
Let’s start with a scenario to illustrate the power of variables. Mary owns a pet store. She has a large email list with four segments based on pet ownership: dogs, cats, birds, and reptiles. She sends personalized email campaigns every month to each segment.
She created a template like the one in the screenshot below. This template generates a good email message but there’s a problem. She has to create a new template every time she wants to change one of these variables:
With AIPRM variables, you can replace static text with placeholders in the prompt. You and your colleagues (and the AIPRM prompt community if it is public) can customize the prompt for each specific use case. Below, I show you three options for adding variables.
This is the easiest way to add variable data to a prompt. In this example, I replace a static month name with a variable placeholder.
Write an email message about the 10% discount in [VARIABLE1] for [PROMPT] aimed at dog owners. The email message should be 100 words or less.
[VARIABLE1:Month]
In the Prompt template text, I replaced the static month with [VARIABLE1]. At the end of the text, I repeated the variable and added the label Month. I also kept the [PROMPT] variable because it is used to enter a product line.
When the user selects this prompt template, AIPRM adds a new field called Month. The user enters the name of the month and text for the product line prompt.
ChatGPT adds the variable data to the content.
Repeat the above steps to add multiple variables. In the example below, I added two more variables to replace static text for discount type and pet type.
Write an email message about the [VARIABLE1] discount in [VARIABLE2] for [PROMPT] aimed at [VARIABLE3] owners. The email message should be 100 words or less.
[VARIABLE1:Discount]
[VARIABLE2:Month]
[VARIABLE3:Pet]
The text input field has three variable inputs plus the prompt.
The ChatGPT output includes all the variable data.
This option builds on Option 1. Instead of displaying an empty variable field, you can insert a default value.
In the example below, I added a default value for the discount type and pet type.
Write an email message about the [VARIABLE1] discount in [VARIABLE2] for [PROMPT] aimed at [VARIABLE3] owners. The email message should be 100 words or less.
[VARIABLE1:Discount:10%]
[VARIABLE2:Month]
[VARIABLE3:Pet:dog]
The text input field shows two default values, which the user can change.
Use this option to replace a blank variable field with a drop-down menu. In this example, I display pet options in a drop-down and select dog as the default.
Write an email message about the [VARIABLE1] discount in [VARIABLE2] for [PROMPT] aimed at [VARIABLE3] owners. The email message should be 100 words or less.
[VARIABLE1:Discount:10%]
[VARIABLE2:Month]
[VARIABLE3:Pet Option:Default Value:dog|cat|bird|reptile]
The user clicks the field to display the drop-down menu.
AIPRM Prompt: Write an Email Marketing Campaign
I want an email marketing campaign prompt that can be reused over and over again.
Here are the variables:
Assuming that I will insert these throughout the prompt, here’s what the template looks like:
Role:
Act as an email marketing expert.
Task:
Write a [VARIABLE1] email marketing campaign, for my business, [VARIABLE2] in the [VARIABLE3] Industry about [PROMPT] in [TARGETLANGUAGE] for [VARIABLE4]. Provide a recommended cadence for the email campaign.
Context:
Using only the [VARIABLE5] marketing framework, write each email to effectively achieve the goal of the campaign.
For Reference – Marketing Email Frameworks:
PAS –
Problem: describe the pain point that the consumer has.
Agitate: discuss how it will only get worse without a solution.
Solve: provide the solution.
AIDA –
Attention: draw in the attention of the reader with an interesting statement.
Interest: keep them going with a supporting statement.
Desire: explain how the product solves their problems or gives them an advantage.
Action: tell them how to grab what you are offering.
Storytelling –
Identifying with the reader by sharing a problem.
Discovering the solution and enjoying the benefits.
Telling the reader how they can enjoy the solution as well.
Format:
IMPORTANT Constraints:
[VARIABLE1:Number of emails],
[VARIABLE2:Business Name],
[VARIABLE3:Industry],
[VARIABLE4:Target Audience],
[VARIABLE5:Email Copy Framework:: PAS|AIDA|Storytelling],
[VARIABLE6:Email Length:: Short|Medium|Long]
You can see how the Number of Emails Variable is notated at the bottom, but seamlessly inserted into the sentence:
Write a [VARIABLE1] email marketing campaign
Say you want to create social media posts in bulk for a new campaign. While your company is on Twitter, Facebook, Pinterest, and LinkedIn, the format for content on each of those platforms is different.
Here’s an example of an AIPRM Prompt that includes those variables:
You can try it out for yourself here:
AIPRM Prompt: Social Media Content Calendar (40 Posts)
Let’s take a look at this prompt:
Role:
Act as an expert social media manager and local SEO specialist in the [VARIABLE2] Industry.
Task:
Please assist in crafting 40 engagement-optimized [VARIABLE1] posts for [PROMPT] in [TARGETLANGUAGE].
Context:
For LinkedIn posts, it’s critical they are long-form posts (3-5 paragraphs each) with short and punchy sentences. Include a bullet point list within the table that highlights key insights.
Format:
Each post should integrate at least 3 relevant keywords for the given industry, presented naturally within sentences. Ensure each post comprises a minimum of five sentences for LinkedIn.
Please put each of these posts in a nice-looking table so it looks like a calendar. For each post, propose a fitting image. The table above should present (1) the post number, (2) the post content, and (3) the recommended image.
After the table, suggest the cadence for the selected social media platform and best posting times.
Constraints:
[VARIABLE1: Social Media Platform],
[VARIABLE2:Industry],
[VARIABLE3: Emojis::Include|Do Not Include],
[VARIABLE4: Featured Product or Service]
You can see how all of the constraints can shape the output based on the variables created.
If you want to learn more about building prompts, creating a prompt library, check out these other tutorials:
As always, if you have any questions, please visit our AIPRM community forums.
2M+ Users
Featured
Share your ChatGPT prompt library with your team, Choose from thousands of pre-built prompts for marketing, SEO, sales, productivity, SaaS, and more.
Already have the extension?
Subscribe to a Premium Plan.