GithubHelp home page GithubHelp logo

noelzappy / chatgpt-whatsapp Goto Github PK

View Code? Open in Web Editor NEW
81.0 5.0 37.0 292 KB

A simple WhatsApp bot that uses OpenAI's ChatGPT to respond to user inputs. Includes a cron to enable ChatGPT to send messages to recipients at periodic intervals.

License: MIT License

TypeScript 93.26% JavaScript 6.74%
bot chatbot chatgpt chatgpt-bot whatsapp whatsapp-bot collaborate github github-codespaces student-vscode

chatgpt-whatsapp's Introduction

Project Description

This project is a WhatsApp bot that uses OpenAI's ChatGPT (GPT-4) to respond to user inputs.

photo_2023-01-06 20 06 27

Requirements

  • Node.js (18.x)
  • A recent version of npm
  • An OpenAI Account
  • A Whatsapp Account

Installation

1. Clone the repository

git clone https://github.com/noelzappy/chatgpt-whatsapp.git
cd chatgpt-whatsapp

2. Install depedencies

yarn install

3. Create .env file and update the update the OpenAI API keys and Organization ID

cp .env.example .env
 nano .env # opens the `.env` file for you to update the details

4. Start the Bot.

yarn start

5. Scan the QR Code with Whatsapp (Link a device)

6. Now you're ready to go :)

Usage

The bot will now respond to all messages you receive.

To use the bot in group chats, simply mention the bot's name or any of the prefixes listed below in your message.

  "gpt",
  "GPT",
  "gpt3",
  "GPT3",
  "gpt-3",
  "GPT-3",
  "bot",
  "Bot",
  "BOT",

To change the prefixes, update the array located inside src/configs/constants.ts

Example

What is the meaning of life?
bot What is the meaning of life?

The bot only responds to messages that are received by you, not sent. It will also work with group messages. The bot will respond to all private messages you receive and only messages taht contain any of the prefixes in group chats. To change the OpenAI model being used, update the OPENAI_MODEL variable in the config/constants.ts file.

Used libraries

chatgpt-whatsapp's People

Contributors

ayushsahu247 avatar niitamer avatar noelzappy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

chatgpt-whatsapp's Issues

How to converse once running?

Apologies for this but I'm rather lost. When scanning the QR code am I meant to scan it with a secondary device to which I will message from a primary device?

ERROR

tsx index.ts
sh: line 1: tsx: command not found
exit status 127

Whatsapp group

Could you make a group so that we could see the bot instead of running it

Error after reading QR code to link other device in the WhatsApp application

I'm getting to the point where I'm authenticating in the Open.AI site, the QR code show up in my terminal and then after I read the QR code to link other device in my WhatsApp application, I'm getting the following error:

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'LegacyPhoneFeatures')
at puppeteer_evaluation_script:13:76
at ExecutionContext._evaluateInternal (/Users/cesarsalazar/chatgpt-whatsapp/node_modules/whatsapp-web.js/node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at ExecutionContext.evaluate (/Users/cesarsalazar/chatgpt-whatsapp/node_modules/whatsapp-web.js/node_modules/puppeteer/src/common/ExecutionContext.ts:140:12)
at Client.initialize (/Users/cesarsalazar/chatgpt-whatsapp/node_modules/whatsapp-web.js/src/Client.js:267:9)

Node.js v18.13.0
error Command failed with exit code 1.

The error message is saying that the script is trying to read a property of an undefined object, specifically the property 'LegacyPhoneFeatures'. where this object is? how to fix it?

Authentication mode is different.

I have created my account using google login, hence I don't have password for my account.. How i am suppose to put credentials in .env file? any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.