Building a custom WhatsApp AI chatbot with ChatGPT and Selenium.

Jay Reddy
2 min readJun 21, 2023

--

Deep dive into ChatAgent development and Prompt Engineering.

Image by Author

Introduction:

Today we are going to see how we can integrate and automate chatCPT on WhatsApp and convert it into an AI chatbot.

It sometimes feels overwhelming to connect to OpenAI or dall-E to generate responses or images right. I felt it too. I am putting up this demonstration for users who wants to build chat agents and integrate them onto message apps or web services seamlessly.

So let’s build something the end product we are going to see is a simple WhatsApp connector client, that will use Selenium web driver to connect to our WhatsApp web and fetch the recent message that we send to ourselves and we use that message which has a prefix of text or image, Separated by a colon.

We use this to either get a text as a response from the open ais API or create an image out of the prompt that we are passing.

So this utility. Gets us the response in text or it will create an image.

So the Selenium web client will fetch the very recent message from our WhatsApp web and it uses that message and interprets the type of message that we want to send in the prompt. And using the prompt we hit the open ais API and get the response from the API and we serve the response back to the end-user or Ourselves using the selenium web driver.

Looks interesting right? Why wait? Check out the video on how I have done it in the code and you can use it to build your self-projects or you can commercialize it with a little more logic.

The code can be found here: https://databracket.gumroad.com/l/pgzpho

Thanks for reading.

Follow me for more….

📰 LinkedIn ➔ https://www.linkedin.com/in/jayachandra-sekhar-reddy/ 🐦 Twitter ➔ https://twitter.com/ReddyJaySekhar
📲 Meet ➔ https://topmate.io/jayachandra_sekhar_reddy

--

--

Jay Reddy
Jay Reddy

Written by Jay Reddy

I write about Data, AI, Startup, and Entrepreneurship. Life without challenges and risks is mediocre. databracket.substack.com youtube.com/@data_bracket