MuleSoft Integration with ChatGPT & WhatsApp— Part 2

Shubham Chaurasia
Another Integration Blog
4 min readMay 5, 2023

In my previous article i.e., Part-1, I wrote about how we can integrate MuleSoft with ChatGPT using ChatGPT API & Connector.

In this article, we will be creating a chatGPT WhatsApp Bot, by integrating MuleSoft with ChatGPT and WhatsApp.

You may be using ChatGPT, by visiting its website and then logging in, and then asking your query. It’s a lot of steps. What if you could ask your questions in your most used/favorite app i.e, WhatsApp. Wouldn't that be fun and a lot easier?

Features of this WhatsApp bot

You can ask questions directly in WhatsApp chat and You can also query for images (e.g., Image of a cat) as well.

Let’s start creating our own ChatGPT WhatsApp Bot. For this, you need to know, how to integrate with ChatGPT and WhatsApp API. You can read or watch these integrations from the below links.

💡MuleSoft Integration with WhatsApp — Medium Article | YouTube

💡MuleSoft Integration with ChatGPT — Medium Blog | YouTube

❒ Meetup Session/ YouTube Recording

I have delivered a Meetup on this topic. You can watch it on YouTube below. You can watch the step-by-step changes you need to do in the code in the below video.

👉 MuleSoft Integration with ChatGPT & WhatsApp— Part 2

👉 First Chapter: Advanced Integrations with ChatGPT

Note:- We will be listening to the questions/queries on the webhook, we created in our WhatsApp Integration.

I have edited the WhatsApp Integration Flow here.

These are the flow structures. You can clone the code from the below repo to replicate it.

Github Repo Link:- ChatGPT_WhatsApp_Bot

For this code, to run, you need to replace the following placeholders, and you will also need to have a CA Signed Certificate configured in your src/main/resources

In mule-whatsapp.xml file

  1. In Send-Message Flow, replace the Phone Number ID with yours

2. Click on WhatsApp_API_HTTP Request Configuration and Go to settings tab, and update the Authorization header Bearer token value with yours.

3. Go to Global Elements and edit the TLS Context. Replace the Certificate Name and Password Placeholders with respective values.

Note:- Your Certificate should be CA-Signed. Self-Signed cert will not work.

In chatGPT.xml file

  1. Go to Global Elements and Edit the ChatGPT_API_Request Configuration, go to the settings Tab and Replace the Authorization Header API key Placeholder with your ChatGPT API Key.

2. Update the WhatsApp API Send Msg Request Path, with your Phone Number ID in the placeholder.

Deploy the Project to Cloudhub after doing the above changes, and update your webhook URL in the Whatsapp webhook console. You now have your own chatGPT whatsApp Bot.

If some issue occurs, you can watch the meetup video, where I have explained each step you have to do.

Final Output Images in WhatsApp

This completes the demonstration of the MuleSoft integration with ChatGPT & WhatsApp.

Important Link For References

Please provide feedback. It will help to improve the content.

Thank you for reading this article! If you found this response useful, please consider giving it a ‘clap’ and Follow me for more helpful articles and insights in the future.

--

--

Shubham Chaurasia
Another Integration Blog

MuleSoft Ambassador | Mule Certified Architect & Developer | 11x Salesforce| 4x AWS | 2x GCP | 2x Solace | 2xAzure | https://linkedin.com/in/shubhamchaurasia1/