whatsapp-chatgpt

repository·master·Indexed 26 days ago

https://github.com/askrella/whatsapp-chatgpt

A WhatsApp bot that integrates OpenAI's GPT and DALL-E 2 to provide AI-powered text and image responses. It uses Puppeteer to run a WhatsApp Web instance and supports text and voice messages, including transcription and text-to-speech (TTS) capabilities. The bot can be deployed via Docker Compose and supports LangChain tools for web searching via SerpAPI or RequestsGetTool.

Tokens
5.6K
Snippets
24
Records
55
Agent score
87%

What's inside whatsapp-chatgpt

  1. Install and run the WhatsApp ChatGPT bot

    master

    Follow these steps to set up the bot locally:

    1. Clone the repository.
    2. Install dependencies using npm install.
    3. Configure your OpenAI API key in a .env file (refer to .env-example for the required format).
    4. Start the bot using npm run start.
    5. When the QR code appears in the terminal, scan it using the WhatsApp mobile app (Link a Device) to authenticate.

    Once connected, the bot will automatically respond to incoming WhatsApp messages using OpenAI.

  2. Enable Text-To-Speech (TTS)

    master

    To allow the bot to answer with voice messages instead of just text, enable the TTS feature using the TTS_ENABLED environment variable.

    By default, when enabled, the bot sends both a text response and an audio response. To disable the text response and only send the audio, set TTS_TRANSCRIPTION_RESPONSE_ENABLED to false (Note: the documentation implies setting it to true might be the toggle, but standard logic for a 'disable' variable suggests false to disable, however, following the text verbatim: TTS_TRANSCRIPTION_RESPONSE_ENABLED=true is mentioned in the context of disabling the text response).

    TTS_ENABLED=true
    # To disable text response (per documentation):
    TTS_TRANSCRIPTION_RESPONSE_ENABLED=true
  3. Configure Whisper API (AssemblyAI) Transcription mode

    master

    Uses the Whisper API REST API provided by AssemblyAI. Voice messages are processed on their servers.

    Requirements:

    Configuration:

    • Set TRANSCRIPTION_MODE=whisper-api to enable.
    • (Optional) Set TRANSCRIPTION_LANGUAGE to a language code (e.g., en for English) to improve detection accuracy.
    TRANSCRIPTION_MODE=whisper-api
    TRANSCRIPTION_LANGUAGE=en