ChatGPT has become everyone’s companion and it seems to be everywhere. There are Chrome extensions of it for every purpose and it is integrated into various platforms. It answers every question we ask. But there’s one question that we don’t ask.
Can you integrate ChatGPT with WhatsApp and use ChatGPT on WhatsApp?
Yes, you can. You can integrate ChatGPT with WhatsApp and use ChatGPT on WhatsApp. You can let it act as a virtual assistant and respond to customer queries. And you can generate images using DALL-E from WhatsApp, a thing that you can’t do with ChatGPT. Don’t believe me? I’ll let the image speak for itself.
Interested? This article will teach you how to integrate ChatGPT with WhatsApp and use ChatGPT in WhatsApp. But first, a few examples of how you can use ChatGPT after you integrate ChatGPT with WhatsApp.
Requirements to integrate ChatGPT with WhatsApp
There are a few things that you’ll need to integrate ChatGPT with WhatsApp.
- npm – npm is the package manager for Node.js that will be used to install the required packages.
- OpenAI API key – Required to integrate OpenAI with WhatsApp chatbot and use ChatGPT on WhatsApp.
If you already have these installed and the OpenAI API key, you can jump to the steps on how to integrate ChatGPT with WhatsApp. Otherwise, you can follow the steps below to install them on your computer.
- Download the latest version of Node.js from here by clicking the appropriate link for your system.
- Open the file and install the application as you install other applications.
If you’re using Linux, you can install it by using the following command.
sudo apt install nodejs
After you’ve installed it, check the version by running the following command. The command is the same irrespective of the operating system.
node -v or node --version
If it is not up-to-date or older than 18.x, then upgrade it by using the following commands.
sudo npm cache clean -f sudo npm install -g n sudo n stable
This will upgrade Node.js to the latest stable version. If the npm command is not recognised, it means that npm is not installed in your system (which is usually installed together with Node.js), in which case you need to install it separately.
npm is installed along with Node.js in Windows and macOS. In some Linux distributions, however, it is not. To check if npm is installed, run this command:
If it is not installed, open Terminal and run the command
sudo apt install npm
Getting OpenAI API key
- If you don’t have the secret key saved, you can create a new one by clicking the “+ Create new secret key” button. Keep the key safe and confidential; the key will not be displayed again.
Note that the API is not free. So unless you have some free credits, you need to upgrade to a paid plan by setting up a payment method.
Steps to integrate ChatGPT with WhatsApp
If you have installed Node.js (and npm) and got your OpenAI API key, you can move on to the next step: integrate ChatGPT with WhatsApp.
Follow the instructions below to integrate ChatGPT with WhatsApp.
1. Clone this GitHub repository. Click the “Code” button and download the ZIP file.
2. Unzip the file.
3. Open Terminal (Linux and Mac) or Command Prompt/Shell (Windows) and navigate to the root directory of the WhatsApp ChatGPT file. Or you can simply open the unzipped folder and launch Terminal or Command Prompt from there.
4. Install the required packages by running the command
5. Open the
.env-example file and replace the OpenAI API key with your own key. Set the PREFIX_ENABLED parameter to false if you want ChatGPT in WhatsApp to be triggered only when messages are prefixed with !gpt or !dalle. And set PREFIXED_SKIPPED_FOR_ME to false if you want to apply the prefix rule to your own messages and don’t want the ChatGPT WhatsApp bot to reply to every message of yours. Then save and rename the file to
6. Open the docker-compose.yml file and fill parameters with your own values. And save it.
7. Activate ChatGPT in WhatsApp by running the following command
npm run start
When you run this command for the first time, a QR code will appear. Scan it from the WhatsApp account to integrate the ChatGPT WhatsApp bot.
Press the “Link a device” option to scan the QR code and integrate ChatGPT with WhatsApp.
After you’ve linked ChatGPT to your WhatsApp account, you must keep the Terminal or the Command Prompt/Shell window open in order to keep the WhatsApp ChatGPT bot active.
To restart the WhatsApp ChatGPT bot, navigate to the root directory and run the following command.
npm run start
The ChatGPT WhatsApp bot is now active and you can interact with it. And it will respond to anyone who messages you on your behalf.
To test it, you can go to your contact list and select the option to chat with yourself. Type in anything and send it. The bot will reply to you.
If you have set the PREFIXED_SKIPPED_FOR_ME variable in .env to false, you’ll need to prefix your prompt with !gpt or !dalle.
How to use ChatGPT in WhatsApp
After you’ve installed the packages and started the ChatGPT WhatsApp bot, you can use ChatGPT from WhatsApp by sending a message to yourself and the bot will reply to your messages.
You can initiate a conversation with the bot by prefixing your messages with !gpt to get text answers or !dalle to generate images from your prompt. You can also set it such that the conversations do not need to be prefixed with the command to chat with the ChatGPT WhatsApp bot.
A cool feature that you don’t get with other ChatGPT integrations with WhatsApp is the ability to generate images with your prompt. This one lets you create images by simply giving it a prompt and it’ll generate images with DALL-E in WhatsApp.
Anyone can message you and the WhatsApp ChatGPT bot will reply on your behalf.
Real-life application of ChatGPT WhatsApp bot
Once you’ve integrated ChatGPT with WhatsApp, you can not only use it to compose emails, learn cooking and get recipes, and even use ChatGPT for coding (things that you can do with the ChatGPT web version), but also use it as a virtual assistant.
You can train it with data about your business and answers to questions that customers frequently ask. The ChatGPT WhatsApp bot will automatically reply on your behalf with all the relevant information, schedule appointments, and so on. Here’s a blog that will give a rough idea of how to implement it as a virtual assistant and how it would work.
Now that you know how to integrate ChatGPT with WhatsApp and use ChatGPT from WhatsApp, take your knowledge further with this article on how to integrate ChatGPT with Telegram.
Some related articles you may find useful