Skip to content

Integration of Dalle-E & ChatGPT for Whatsapp to create an automated response and image generation bot.

Notifications You must be signed in to change notification settings

chengduzhusiyu/ai-chat-assistant-whatsapp

Repository files navigation

🤖 AI Chat Assistant for WhatsApp

This is a personal project that utilizes the whatsapp-web.js library and the GPT-3.5 Turbo model to automate WhatsApp messages responses and use Dall-E to generate images from prompts.

🛠️ Technologies Used

The bot was developed using the following technologies:

  • NestJS - Provides a scalable architecture for server app development.
  • Prisma - ORM that makes database interactions easier.
  • PostgreSQL - Open source relational database.
  • OpenAI API - API for natural language processing and artificial intelligence.
  • TypeScript - A JavaScript superset that adds static typing to the language.
  • Fastify - Used as an adapter with NestJS focusing on performance and scalability.

🚀Features

  • Conversation utilizing the power of ChatGPT by just sending messages through WhatsApp.
  • Image generation using the command /imagine your prompt.
  • Clear the message history from the database using the command /clear.
  • Get help on available commands using the command /help.

See the image below as an example: Example image

🧪How To Use?

To begin using the BOT, follow these steps:

  1. Send a text message to the whatsapp number +55 (88) 98147-8937 or click here.

  2. The message will be forwarded to the ChatGPT API for an automatic response. When using the environment, please bear in mind that all sent and received messages are stored in a database. These messages will be kept until the /clear command is executed to clear the history.

Additionally, while using the ChatGPT API and Dall-E, keep in mind that the terms of use of OpenAI also apply. Please ensure to review and agree with these terms before using the API.

🛠️Installation and Configuration

To install and configure the API, follow the steps below:

  1. Create an account on OpenAI and grab your credentials. Create the .env file. The .env.example file is in the root of the project. See example below:
OPENAI_API_KEY=
DATABASE_URL=
BOT_PERSONA="Bot Persona"

The DATABASE_URL field must be filled with your database URL. By default, it is configured to use PostgreSQL.

  1. Install the project dependencies with the following command:
npm install
  1. Start the API on localhost with the command:
npm run start:dev
  1. Wait for the QR Code to appear in the Terminal, on your mobile Whatsapp go to "Connected Devices" and scan the QR Code Generated.

  2. Now, just send a message to your number and wait for the response.

About

Integration of Dalle-E & ChatGPT for Whatsapp to create an automated response and image generation bot.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published