How to Use Variables in Prompts with AIPRM

··7 mins
Christoph C. Cemper

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.

Base case>

Base case #

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:

  • discount type (e.g. 10%, 12%, etc.)
  • month (e.g. March, April, etc.)
  • pet type (e.g. dog, cat, etc.)
screenshot
BTW The text in the Prompt Template field is incomplete. It is missing many important parts (e.g. TARGETLANGUAGE) which were removed here to simplify the case. Be sure to read Prompt Author Guidelines and learn how to create a Prompt Template.
Adding variables>

Adding 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.

In AIPRM, you can create up to six variables per prompt on the Pro Plan.
Option 1>

Option 1 #

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.

  1. Go to the Prompt Template field.
  2. Insert a unique variable name like [VARIABLE1] into the text.
  3. At the end of the text repeat the variable name and add a label.

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.

screenshot
Result>

Result #

ChatGPT adds the variable data to the content.

screenshot
Adding more variables>

Adding more variables #

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.

screenshot

The ChatGPT output includes all the variable data.

screenshot
Option 2>

Option 2 #

This option builds on Option 1. Instead of displaying an empty variable field, you can insert a default value.

  1. Go to the variable label at the end of the text.
  2. Insert a colon and enter the 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]

Result>

Result #

The text input field shows two default values, which the user can change.

screenshot
Pro-Tip: As you get more sophisticated with your variables, test out various examples to see if the prompt still makes sense. Sometimes an edge case can have unintended consequences.
Option 3>

Option 3 #

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.

  1. Go to the variable label at the end of the text.
  2. Insert a colon after the label.
  3. Insert the text Default Value.
  4. Insert a colon and the default menu option (e.g. dog).
  5. Enter a line (|) and the next menu option.
  6. Add more menu options each separated by a line (|).

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]

Result>

Result #

The user clicks the field to display the drop-down menu.

screenshot
Other use cases>

Other use cases #

Write an Email marketing campaign>

Write an Email marketing campaign #

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:

  • Number of emails
  • Email length
  • Target Audience Segment
  • Industry
  • Email Copy Framework
  • Campaign Topic

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:

  • Provide the email cadence first.
  • Offer 3 subject lines for each email.
  • Leave placeholder opportunities for First Name and other personalization throughout the email.

IMPORTANT Constraints:

  • Make sure that the emails are [VARIABLE6].
  • Do NOT include any emojis in the email, including the subject line.
  • When writing the emails, do NOT explicitly mention any part of the marketing framework.

[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

Social Media Content Calendar (40 Posts)>

Social Media Content Calendar (40 Posts) #

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.

  • You want content specifically for Facebook.
  • You need it for this specific product that you’re rolling out.
  • This needs to be tailored to your industry.

Here’s an example of an AIPRM Prompt that includes those variables:

screenshot

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:

  • Avoid mentioning discounts or new product launches.
  • Make the posts educational, informative, or entertaining.
  • Do not be self excessively self-promotion in the posts.
  • [VARIABLE3] emojis in the posts.
  • Feature [VARIABLE4] in a quarter of the posts.
  • Adhere strictly to the guidelines provided.

[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

Introducing Teams: Share Your Prompts

Share your ChatGPT prompt library with your team, Choose from thousands of pre-built prompts for marketing, SEO, sales, productivity, SaaS, and more.