Starting in version 1.4, TrainMyAI can be integrated with WhatsApp to provide AI-powered chat within the familiar WhatsApp interface. In order to complete the integration, please follow these steps:
- Ensure your TrainMyAI site can be accessed using a secure (https) URL. (This is a WhatsApp requirement.) In order to do this you may need to: (a) activate https in your web server’s configuration, (b) set up a domain name or subdomain for your TrainMyAI site, (c) purchase and install an SSL certificate, or use Let’s Encrypt.
- Create a Facebook account if you don't already have one.
- Use your Facebook login details to create or sign in to a Meta for Developers account.
- Click to create a "Business" app with WhatsApp integration, and follow the instructions to complete the process.
- From this new app's dashboard, add "WhatsApp" from the list of products, and follow the instructions to complete the process. This may include creating a "Meta Business Account" if you don't have one already.
- Once the WhatsApp product has been added to your app, click "API Setup" under the WhatsApp menu (on the left).
- In your TrainMyAI site Configuration page, switch on WhatsApp chats and save changes.
- Copy the "Temporary access token", "Phone number ID" and "WhatsApp Business Account ID" from the WhatsApp API setup page into the corresponding fields on the TrainMyAI Configuration page. Please note that, while your app is in testing, the "Temporary access token" will change and need to be copied again every 24 hours.
- On the WhatsApp API setup page, add the "To" phone numbers from which you might send messages during testing.
- In the Meta Developer site, click "Configuration" under the WhatsApp menu then "Edit" in the "Webhook" section.
- Copy the "Callback URL" (ending whatsapp_webhook) and "Verify token" (trainmyai) from the TrainMyAI Configuration page to the corresponding fields in the Webhook popup, and click to verify and save.
- Click to manage the "Webhook fields", check the subscribe box next to messages and save.
- Set the other WhatsApp options in the TrainMyAI Configuration page as appropriate, and click to save changes.
- This completes the test integration, now it's time to try it! In the Meta Developer site, click "API Setup" under the WhatsApp menu. Using a phone with one of the numbers you added in the "To" section, add the "Test number" shown to this phone's list of contacts. Then send a WhatsApp message to this test number. Your message should quickly receive a blue tick (meaning it was received by TrainMyAI) and then a reply a few seconds after.
- To make your WhatsApp integration live, follow the steps on the WhatsApp "API Setup" page, as well as the instructions on the WhatsApp "Configuration" page to create a permanent API access token.
Getting help
If you encounter any problems integrating TrainMyAI with WhatsApp, please contact us and we'll be happy to help.