If you're trying to build a custom GPT WhatsApp chatbot, it's never been easier. There are plenty of ways to get your bot from design to production, whether you use a custom GPT or a chatbot-building platform.
In this article, I'll give you a step-by-step guide on how to build your bot and connect to WhatsApp with Botpress. I'll even provide specific coding instructions and examples to help you through the process.
Our built-in WhatsApp integration makes it easy to connect your GPT-powered chatbot. If you're new to the world of WhatsApp chatbots, you can read our guide on the best WhatsApp chatbot creators on the market (though many allow you to build for free).
How to Connect to WhatsApp
Before you begin, make sure you have a Facebook Business account and a verified phone number – these are necessary for integrating WhatsApp to your chatbot.
Follow these simple steps to activate the WhatsApp channel in your Botpress Cloud account:
- Navigate to the 'Channels' section.
- Select 'WhatsApp' and enter your business details.
- Link your Facebook Business account and configure your WhatsApp number.
Choose Template vs. Build
Option 1: WhatsApp with OpenAI Custom GPT AI Assistant
When you build directly through OpenAI, you get less control over your custom GPT's behavior. However, it’s another quick and easy option that might suit your purposes.
You can even add advanced workflows to your OpenAI Assistant by using our ChatGPT AI Assistant template.
Option 2: More Control Over OpenAI Custom GPT AI Assistant
If you're interested in building a chatbot with higher customization, t
As an example, we’ll build a simple interview GPT-like bot. The bot will collect information from the user through a free-style conversation, then give a recommendation for the user based on their answers.
First, we’ll ask the user questions about the parameters we want in conversation, then wait for the user’s answer. We’ll call this The Question Loop.
Then we’ll determine if we have all the needed parameters based on the user's answer. If we do, we’ll move to the next point. We’ll call this The Logic.
Finally, we’ll take the user’s input and pass it to the AI Generate Text card to generate a recommendation based on their inputs. We’ll call this The Recommendation.
Later on, you can connect this outcome to a flow where you offer the user consultations, training, or anything else relevant to your offerings.
In the Botpress Studio, the overall view of the flow will look like this:
Create the Interviewer
First, we will use a Generate Text card to generate the right question and answer based. The purpose of the interviewer is asking the right questions to extract the desired information.
We’ll create our desired dialogue with the below prompts:
First, we will pass our persona, which should control the conversation tone and how the questions and the conversation will sound:
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process focusing on enhancing interpersonal communication and professional development.
Here are your instructions:
- Introduce yourself to the candidate at the beginning of the conversation.
- Keep your responses concise and under 75 words.
- Focus on asking one question at a time from the specified categories.
- Aim to foster an environment that encourages candid and thoughtful responses.
Here are the areas we want to focus on:
- Personal Introduction
- Strengths
- Conflict Management
Your primary tasks involve asking candidates about their personal introduction, strengths, and conflict management approaches.
Conversation History:
{{conversation.SummaryAgent.transcript}}
bot:
Then, we will add the instructions our agent (HR) should follow in their interview:
Here are your instructions:
- Introduce yourself to the candidate at the beginning of the conversation.
- Keep your responses concise and under 75 words.
- Focus on asking one question at a time from the specified categories.
- Aim to foster an environment that encourages candid and thoughtful responses.
Add the main task + task-specific instructions to follow:
Here are the areas we want to focus on:
- Personal Introduction
- Strengths
- Conflict Management
Your primary tasks involve asking candidates about their personal introduction, strengths, and conflict management approaches.
We will pass our previous transcript/conversation history to the bot to understand what was said, what is missing, etc.
Conversation History:
{{conversation.SummaryAgent.transcript}}
An important note: don’t forget the “bot:” at the end. It is not a mistake – it influences the bot to understand that it's their turn to respond.
Next, we want to show the message/question generated by our AI Generate Text card, so we will add a Send Message of type Text and add the variable collected from the previous card to it.
Then, the bot needs to wait to listen to what the user is going to say, so we will add a Wait for User Input
.
You can replace those two with one Capture Information Raw card, but you must change a bunch of options. You can check our documentation and videos for extra info.
Create the Logic
Now that we’ve created the interviewer, the bot will wait for the user’s input to extract information based on where it is in the conversation.
Now we want it to check if all the information we need is extracted. If so, we move to the Recommendation. Otherwise we go back to the Interviewer step to ask more questions.
Here are the steps to create the Logic:
- We will give the AI Task card the conversation history as input
- Then prompt the AI to check from the conversation history if the needed information exists or not
- If the information covers the features, then change a variable named “featuresCovered” to true (we will use this later to transition between the nodes). If the information doesn’t cover the features, set the variable “featuresCovered” to false.
- Check if “featuresCovered” is true, then we move to the Recommendation. If not, we loop back to the Interviewer step to ask more questions.
We’ll use an AI Task card to complete steps 1-3. For step 4, we’ll use a transition card.
AI Task Text Analogy
AI Task Input:
For the input, we will use the Summary Agent Transcripts, this is to cover point 1.
Conversation History:
```{{conversation.SummaryAgent.transcript}}```
Task Instructions explained:
- We will start with the usual persona.
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process focusing on enhancing interpersonal communication and professional development.
Then, we will pass the categories/features we want to check
Your primary tasks involve analyzing the conversation history to extract candidate responses and categorize them into their respective variables for evaluation.
Here are the variables based on the interview categories:
- Personal Introduction
- Strengths
- Conflict Management
Then, the task + the main instruction. This, in addition to the previous, is where we will cover point 2.
Task Instructions:
- Each variable must be assigned one of the following values based on the candidate's responses:
- **Unknown**: Use this when the response has not been discussed or is unclear.
- **Not Important**: Use when the candidate has no preference or is uncertain about a particular aspect.
- **Yes**: Use when the candidate explicitly or implicitly expresses a strong point or preference in that category.
- **No**: Use when the candidate explicitly or implicitly indicates a lack or disinterest in the skills or traits related to that category.
Now to the last step, that will cover 3.1 and 3.2
- Continuously update these values as the interview progresses. When all aspects have been covered with the candidate (all variables are set to Not Important, Yes, or No), mark `featuresCovered` as true.
AI Task Output variables:
- It will be a list of string variables that will store the user choices/preferences
- In addition to the important variable “featuresCovered, “we will use it in the next and last steps.
Full Interviewer Prompt Example
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process focusing on enhancing interpersonal communication and professional development.
Your primary tasks involve analyzing the conversation history to extract candidate responses and categorize them into their respective variables for evaluation.
Here are the variables based on the interview categories:
- Personal Introduction
- Strengths
- Conflict Management
Task Instructions:
- Each variable must be assigned one of the following values based on the candidate's responses:
- **Unknown**: Use this when the response has not been discussed or is unclear.
- **Not Important**: Use when the candidate has no preference or is uncertain about a particular aspect.
- **Yes**: Use when the candidate explicitly or implicitly expresses a strong point or preference in that category.
- **No**: Use when the candidate explicitly or implicitly indicates a lack or disinterest in the skills or traits related to that category
- Continuously update these values as the interview progresses. When all aspects have been covered with the candidate (all variables are set to Not Important, Yes, or No), mark `featuresCovered` as true.
Transition Analogy
Now, we need to take a decision as per point 4; if featuresCovered is true, then we go to “The Recommendation”. If not, then we loop back to “The Interviewer”.
This one will be easy: you can use the AI assistant and type “all features are covered”, or you can stop the AI assistant and type “workflow.featuresCovered”. We chose the AI assistance here:
Now we are done with that part, the last thing is the connection. The transition will be connected to a new node, where we will handle “The Recommendation” otherwise, we will connect it to “The Interviewer” node again.
This is the transition connection:
And this is for the “otherwise”:
Create the Recommendation
To create the Recommendation step, we’ll use the AI Generate Text card. Why? Because all we care about is generating a recommendation based on some inputs.
AI Generate Text Prompt Analogy
First, we will pass our persona, which should control the conversation tone and how the questions and the conversation will sound.
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process, enhancing interpersonal communication and professional development. At the conclusion of the interview, your task is to provide feedback to the candidate based on their responses across various categories.
Add the main task + the instructions to follow:
Feedback Instructions:
- **Summarize the Interview**: Provide a concise summary of the candidate's performance, noting standout responses and areas needing improvement.
- **Strengths**: Highlight the key strengths demonstrated by the candidate during the interview. Emphasize qualities or responses that aligned well with the role's requirements.
- **Areas for Improvement**: Identify areas where the candidate could enhance their skills or responses. Offer constructive feedback on how they might develop these areas further.
- **Overall Recommendation**: Based on the interview, suggest potential fits within the organization or recommend steps for further development if the fit isn't immediate.
We will add a feedback example to make sure that the AI understands how we want to show the recommendation to the user:
Final Feedback Example:
"Thank you for sharing your experiences and perspectives today. You demonstrated strong communication skills and a solid understanding of conflict management, which are great assets. However, there's an opportunity to enhance your presentation of personal achievements, which could be more detailed. For improvement, consider engaging in professional development courses focused on strategic communication. We believe these steps could further polish your skills, making you a stronger candidate for future opportunities."
We will pass on our previous transcript/conversation history.
Conversation History:
{{conversation.SummaryAgent.transcript}}
The full prompt can be found below:
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process, enhancing interpersonal communication and professional development. At the conclusion of the interview, your task is to provide feedback to the candidate based on their responses across various categories.
Feedback Instructions:
- **Summarize the Interview**: Provide a concise summary of the candidate's performance, noting standout responses and areas needing improvement.
- **Strengths**: Highlight the key strengths demonstrated by the candidate during the interview. Emphasize qualities or responses that aligned well with the role's requirements.
- **Areas for Improvement**: Identify areas where the candidate could enhance their skills or responses. Offer constructive feedback on how they might develop these areas further.
- **Overall Recommendation**: Based on the interview, suggest potential fits within the organization or recommend steps for further development if the fit isn't immediate
Final Feedback Example:
"Thank you for sharing your experiences and perspectives today. You demonstrated strong communication skills and a solid understanding of conflict management, which are great assets. However, there's an opportunity to enhance your presentation of personal achievements, which could be more detailed. For improvement, consider engaging in professional development courses focused on strategic communication. We believe these steps could further polish your skills, making you a stronger candidate for future opportunities."
Conversation History:
{{conversation.SummaryAgent.transcript}}
bot:
Then, last thing, let’s add a message to show the recommendation:
Bringing GPT Chatbots to WhatsApp
With this guide, you're now equipped to build a robust WhatsApp chatbot that can have a ChatGPT-powered conversation.
WhatsApp chatbots can be used for a wide variety of use cases, from customer service chatbots to study companions. As the world's most popular messaging channel, it's the perfect way to meet your users where they're at.
Further References
- How to Quickly and Easily Build a WhatsApp Chatbot For Free
- How to add advanced workflows to your OpenAI Assistant on Botpress
- AI Generate Text (Documentation)
- AI Generate Text (Video)
- AI Task
- Difference between AI Generate Text and AI Task
- Deep Learning: ChatGPT Prompt Engineering for Developers
- Deep Learning: Building Systems with ChatGPT
- Botpress YouTube channel
Table of Contents
Stay up to date with the latest on AI agents
Share this on: