How to configure OpenAI’s ChatGPT to receive and respond to SMS and WhatsApp in Avochato.
To get started, you will need account access to three different services:
- Zapier (to enable the zap configuration steps shown below)
- OpenAI (to configure the processing model used)
- Avochato (to send and receive these messages from a valid business number)
Once you have active accounts for the services listed above, follow the steps below to setup ChatGPT with an SMS-enabled Avochato number. Note that Step 3 of the Zap (”Text in Formatter by Zapier”) is optional and only applicable if you wish to setup WhatsApp in addition to SMS. WhatsApp requires a separate business approval process. You can delete this step in the zap if you are only looking to set up SMS. Contact us if you would like to initiate the WhatsApp approval process. The WhatsApp Avochato integration allows you to WhatsApp-ify a new or existing SMS number, and you will be able to have separate conversations in your Avochato inbox for SMS and WhatsApp using the same, single phone number. Click here to learn more about the WhatsApp integration.
2) You will be redirected to this window where you will configure the Zap by completing the following steps:
3) Click on “1. New Inbound Message in Avochato” to expand and show configurations that needs to be added. “App & Event” should be pre-populated and will have a green checkmark.
4) Click “Account” to expand it. Here you will need to connect your Avochato account by clicking “Sign In”.
5) A new window will pop-up asking for your Auth ID and Auth Secret.
To locate both of these, go to your Avochato account and select the inbox (phone number) that you want the ChatGPT model to use for receiving messages and sending back its responses to the user. After you have selected the inbox, navigate to “Settings” and under “Texting Automation” click “API Access”. Select a user, then click on “Generate Credentials” to get your Auth ID and Auth Secret keys.
Note: You will need to have an upgraded account on Avochato to access the API. Contact us if you do not have access to the API settings.
6) Once you have provided your Auth ID and Auth Secret and you see a green checkmark beside “Account”, you can now proceed to “Test” and click “Test Trigger”
7) When you get “We found a message!”, that means Zapier has successfully communicated with your Avochato account. You can now proceed to the next step by clicking “Continue”
8) Click on “2. Conversation in ChatGPT” to expand and configure it. “App & Event” will be pre-populated and no changes will be needed. What you’ll need to do here is go to “Account” and connect your ChatGPT account by clicking “Sign In”
9) A new window will pop-up asking for your API Key from ChatGPT. If you haven’t yet, login to your ChatGPT account and click this link or click “View API Keys” on the window pop-up to get your API Key (secret key). You can confirm that you have successfully signed in if you see a green check mark beside “Account”. Click “Continue” to proceed to “Action”.
Note: You will need to generate a secret key for the first time and you will need to generate a new one again if you lose it for security reasons.
10) Under “Action”, there are a few settings you can change to customize how ChatGPT will behave to incoming messages. Below are explanations for each field:
- User Message (Required): Click on space below “User Message” and select “1. Message Body:” from the drop down selection. This is mandatory for the integration to work as this part configures the Zap to communicate the text message to ChatGPT.
- Model: Determines the ChatGPT model to be used for responding. Note that depending on your OpenAI account you may have access to multiple different models.
- Temperature: Higher temperatures will make the output more random, while lower values will make it more focused and deterministic.
- Assistant Instructions: This is the prompt that you give the model to give it guidance on what to say and how to say it. This is the most important field to configure, as it determines the overall behavior of the model and adapts to the use case that you wish to configure. There is a limit to how many characters you can include in the prompt depending on the version model used. We strongly recommend experimenting with this prompt in the OpenAI Playground before configuring it.
- User Name: This is how the model will address the other party it is communicating with.
- Assistant Name: This is the name of the OpenAI assistant.
- Memory Key: We recommend setting this to “1. Contact Phone Number:”. This will allow the model to remember the conversation it had with that specific phone number, and it will build conversational knowledge specific to that unique conversation.
Once you have set the “User Message” to “1. Message From:”, you can now click “Continue” as this is the only required portion of this step.
11) Test the action by clicking “Test” and it should show something similar to the image at the right if it is successful. If you see a green checkmark at the right side, you can now proceed to the next step.
12) The “Text in Formatter by Zapier” step is optional and is mainly required for ChatGPT to work with WhatsApp. You can delete this step by clicking on the three dotted symbol (•••) and choosing “Delete” if you do not plan to use ChatGPT with WhatsApp conversations. If you have WhatsApp enabled in Avochato, or plan to do so in the future, you can configure this step as seen below in order for ChatGPT to work with both SMS and WhatsApp conversations.
Under “App & Event” then “Event” choose the “Text” event.
Under “Action” then “Transform” Select “Spreadsheet-Style Formula”
Under “Action” then “Formula” type the following command, making sure to substitute Zapier fields in everything in brackets below:
=if(”[insert Message Origin from Step 1]” = “whatsapp”, “whatsapp: [insert Contact Phone Number from Step 1]”, “[insert Contact Phone Number from Step 1]”)
Click “Continue” on both the “Action” and the “Test” steps.
13) Click on “4. Send Text Message in Avochato” to expand and configure it. “App & Event” will be pre-populated (no changes needed) and “Account” should show your Avochato account that you linked earlier in “1. New Inbound Message in Avochato”.
What you need to do here is to change the following fields under “Action”:
- Phone Number: Change this to “1. Contact Phone Number”
- Message: Change this to “2. Assistant Response Message”
Optional fields you can configure are:
- Tag: Adds a tag to the contact that sends a message to the ChatGPT configured number
- Media URL: Adds an image to every response the ChatGPT model gives by using a publicly available image URL (uses 1 mms segment)
- Message Status Callback URL: URL to send a POST request to on every status change while this message is being delivered.
14) Once done, publish the Zap and test the integration if it works by sending a message to the number you chose the ChatGPT model to use.