The Inspire Cyber Monday promo has been extended to Dec. 1! This offer is discounted off the Early Bird price and includes 20% off for conference-only passes and 10% off training passes.

Data Science

Machine learning & data science for beginners and experts alike.

AI technologies like Chat GPT are everywhere, and everyone wants to use them to make their job simpler.


At Alteryx, we’ve already started building these technologies into our tools with new features like Alteryx Auto Insights Magic Documents and the Workflow Summary Tool.


The new OpenAI Connecter Tool allows Alteryx Designer Desktop users to connect directly to Open AI and use models such as ChatGPT directly within their workflows. It already has a great how-to guide here


This post covers seven universal steps to generate custom marketing content using the Open AI connector in Alteryx Designer Desktop and then walks through the results of three different use cases that followed the seven-step process.  Download the workflow from Gallery to try it out, or use it as a starting point to customize your own marketing content.


Use Case 1: A Medical Provider

A medical provider (doctor’s office, insurance company, or government insurer) wants to contact patients who have not been to the office in 1 year or longer to remind them to make a routine care visit. The letter should be personalized if the patient has a chronic medical condition such as heart failure.


Use Case 2: A Financial Institution

A financial institution is offering a new deposit program and wants to customize letters to customers based on the account holder’s current balance.


Use Case 3: A Consumer Goods Retailer

A consumer goods retailer is offering a sale on a product and wants to customize marketing communications based on the type of product customers bought in the past.


The 7-Step Process


Across each use case, a similar technical process is used, as shown in the workflow below.  Each use case follows the same overall flow from left to right.  Let’s walk through the process step-by-step. 




1. Prepare the Data


This process relies on having a list of customers or potential customers and some previous knowledge about them.  This may exist in a flat file, a cloud data source, or a combination of sources. In the use cases here, a synthetic dataset is used. 


The data should have a row for each customer with key information to personalize communication and an email or mailing address if sending will be automated through Designer Desktop. In the use cases here, age and presence of a chronic medical condition were used in use case 1, account balance was used for use case 2, and type of tent previously purchased for use case 3.  This step might also include checks to ensure your data is complete and accurate.


Pro Tip: Grouping/Binning Data 


In some cases, each communication should be 100% customized to the individual consumer, but usually, one message can be sent to a subgroup of people based on a characteristic they share. For example, in use case 1, consumers are segmented to age groups and the presence of a chronic health condition; in use case 2, consumers are split based on ranges of account balances. This can reduce the number of requests sent to Chat GPT (saving money!) and the amount of review and editing time by a real person (saving time!).


In those cases, use a formula tool to convert a continuous variable like age into a discrete bucketed variable or use if-then statements to group consumers on similar characteristics. 





2. Identify Customer Segments


If using the pro-tip above, identify the different segments of consumers by using the summarize tool to find each unique combination of characteristics to target.  In use case 1, patients were split by age group and the presence of a chronic health condition.  In use case 2, banking customers were split by account balance, and in use case 3, customers were split by the type of tent they previously purchased.


3. Build a Prompt


Writing a good prompt is the key to getting a good response from a Large Language Model.  Use a formula tool to build a specific and detailed prompt.  The prompt should specify what information should be included in the response, how it should be formatted, and any other details such as mood, complexity, grade level, language, etc.  Be sure to include the customer segment information too if that should be built into the response.  At the end of this post, check out a series of prompts and responses for use case 3. 


4. Configure Open AI Connector Tool


The OpenAI connector tool is used to send the prompt to OpenAI and get a response. If the tool hasn’t been downloaded or used before, use this post to download and set up the connector. This is what the tool configuration looks like:





First, select the top button to Save/Update API Key in DCM.  Within the DCM window, select the existing Open AI connection.  Then, press the blue Connect button to connect credentials.


Select the column for the prompt.  In the Completion Type field, select Chat Completion to use a Chat GPT model.  If a text completion model is preferred, select that. 


In the Select Algorithm field, select the preferred model.  Chat GPT 3.5 turbo and Chat GPT 4.0 are the default options for Chat completion.  Chat GPT 4.0 has generally better performance but is more expensive.  To use an OpenAI model not included in the list (for example if a GPT-5 were to be published in the future), select Enter a Custom Algorithm and type the desired algorithm name into the custom algorithm box.


Temperature can be set between 0 and 2.  High temperature values give more random results and may not make sense.  Low values have less variation and very little creativity.  For tasks like text generation with some degree of personalization, starting with a temperature near 1 is good. 


Max tokens is the allowed length of the response.  As a rule of thumb, 4 characters is about 1 token, and 75 words is about 100 tokens.  The number of tokens should be set to how long the response should be.  A yes/no response should be 1-2 tokens, one or two sentences should be around 30 tokens, and a letter might be several hundred tokens.  For Chat GPT 3.5 the total token limit for the prompt and response is 4,096 tokens; for Chat GPT 4.0, the total token limit is 8,192.


5. Review the Open AI Responses and Make Changes if Needed


This step is important – don’t skip it!  Chat GPT is good, but it’s not perfect.  Sometimes, it may use words or phrases that are unexpected, rude, wrong, or the wrong tone – so it’s important to review the results before distributing to customers.  If the response isn’t as expected, try rewriting the prompt to get a better result.  If small pieces of the response need to be edited, formula tools can be used to make minor modifications.


Pro Tip: Tool Containers to Execute Individual Steps


Group tools that should run together into tool containers.  Use the top left button of the container to turn it on or off – this allows sections of the workflow to run independently.


6. Join Edited Response Back to Customer List


If a summarize tool was used to segment groups of customers in step 2, use a join tool to assign a prompt response to each original customer record.  The join should use the fields that were originally used for segmentation with the Summarize tool.  In Use Case 1, age and presence of a chronic illness.  In Use Case 2, age group and account balance range, and in Use Case 3, type of tent purchased.


7. Distribute


The final step is to distribute the personalized communications to customers.  Export results to Excel or a cloud database to use with a marketing email platform or use the built-in Alteryx tools to email directly from Alteryx.


Take it Further


Steps 1 through 7 will provide targeted marketing content that meets the needs of many organizations, but some organizations may want to further customize their marketing.  Here are a few ways to take targeted marketing to the next level:


  1. Enhance using the geolocation: customize even more by identifying customers in specific regions or within a specific distance of your facility or other point of interest
  2. Deep-dive segmentation with Alteryx data packs: add basic household information from US census data or detailed consumer data based on the consumer’s home address.  Customize prompts using information specific to the customer’s household.
  3. Integrate consumer response into your marketing analytics to understand what changes can make your personalized marketing even better. Perform A/B testing on AI-generated text to understand what type of content delivers the best returns.
  4. Keep an eye out as new AI tools are constantly under development at Alteryx – there’s more to come!


Need a hand? The Alteryx Professional Services team has deep marketing expertise and can customize a solution to meet your needs.


The Results


Full results are available in the downloadable workflow package posted on Community


Use Case 1: Medical Office


The following prompts were used in use case 1:


Age Group

Health Conditions






high blood pressure and another chronic condition, high blood pressure, no chronic health condition

"Compose the body of a letter to a person in the following age group.  Invite them to make a return visit to their doctor because they have not visited in over 12 months.  If they have a chronic health condition, remind why they need routine care. The letter should be 200 words or less and written at a 12th grade level with proper punctuation.

Age: " + [Age Group] + "years

Chronic Health Condition: " + [has-health-condition]


The corresponding responses from ChatGPT-4 are below, prior to editing.  As mentioned in the input prompt, each letter addresses the importance of routine medical care, identifies chronic health conditions where appropriate, and some letters mention the patient’s age.




Use Case 2: Financial Institution


The following prompts were used in use case 2:


Account Balance


$0 - $5,000,

$5,000 - $20,000,

$20,000 – $100,000


"Draft a short marketing email to a person with the following account balance at their financial institution.  The date today is March 1st.  Let them know that their banking  has a holiday certificate of deposit special for CD's opened between March 1 and April 30 with an APY of 4.25%.  CD's will mature on December 15 and the balance will be automatically transferred to their checking accounts.  The minimum deposit is $1,000 and the maximum  is $10,000. The letter should be 200 words or less and written at a 12th grade level. Emphasize the impact of the CD as it relates to the customer's account balance.

Account Balance: " + [account balance]


Note that the marketing letters below do not emphasize the values or needs of customers with specific account balances. For example, a customer with a low account balance might care more about simple ways to save, while a customer with a high account balance might care about safe, low-risk ways to save.   However, customers’ values and needs were not mentioned in the prompt.  Be sure that the prompt includes all of the desired elements of the output.




Use Case 3: Retail/Consumer Goods


The following prompts were used in use case 3:


Tent Type


Backpacking Tent, Family Tent, or 2-person tent

"Draft a short marketing email (200 words or less) to a customer from an outdoor store to let them know sleeping gear is 20% off to customers who bought a tent in the past 12 months.  Sleeping gear could include sleeping bags, pads, and mattresses, hammocks, blankets, pillows, cots.  Personalize the email based on the type of tent the person bought, and a  product that might work well for that type of tent.

Tent Type: " + [Tent size]


The corresponding responses from ChatGPT-4 are below, prior to editing. Note that in this use case, specific products were recommended based on the previous type of tent purchase.




Keep in Mind


Remember, ChatGPT is an open-source utility.   To run this tool, an OpenAI account and API Key are required. Head over to to create a free account, get access to free starter credits, and create a unique API Key. Additional charges might occur after using the free credits.


Bonus Content: Prompt Engineering


Below are a series of prompts to ChatGPT-4 and the corresponding responses (copied into an email template).  As the prompt is refined, the letter becomes more specific to the user’s needs.  Open AI has a guide for best practices in prompt writing that can help optimize results – notice that the results above could even be improved by incorporating additional best practices from Open AI!


Email a customer that the store is having a sale on sleeping bags.




Email a customer who bought a tent last year that the store is having a sale on sleeping bags.




Email a customer who bought a backpacking tent last year that the store is having a sale on sleeping bags.




Email a customer who bought a backpacking tent last year that the store is having a sale on sleeping bags.  The letter should be 150 words or less.




About Alteryx Professional Services


The Alteryx Professional Services team is a group of trusted advisors who can assist you as you define, develop, and execute your vision for the Alteryx platform.  We can help accelerate your analytics capabilities through deployment and migration, creating process control and governance frameworks, building automation efficiencies, or developing custom analytic solutions.  Get in touch if you want help on your analytic journey!