npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

whatsapp-claude-gpt

v1.1.1

Published

Introducing WhatsApp-Claude-GPT Bot, a cutting-edge AI conversational agent that brings the power of OpenAI's GPT models and Anthropic's CLAUDE to WhatsApp. Featuring dual AI capabilities, this bot leverages GPT-4 for enriched dialogues, DALL-E 3 for imag

Downloads

117

Readme

WhatsApp-Claude-GPT

WhatsApp-Claude-GPT is a chatbot application designed for seamless interaction on WhatsApp. It offers two options for creating a WhatsApp bot: using OpenAI (with ChatGPT) or Anthropic (with Claude). The application leverages state-of-the-art language models to generate textual responses and engage in conversations with users.

Please note that image and audio creation functionalities are exclusive to OpenAI. To use these features, you must provide an OpenAI API Key, even if you choose to use Anthropic's Claude for text generation.

Key Features

  • Automatic Responses: Generates coherent and contextual responses to received messages.
  • Image Creation (OpenAI only): Can create images from text descriptions using the -image command.
  • Voice Interaction (OpenAI only): Capable of both understanding voice messages and responding with its own voice messages upon request.
  • Group Interaction: When added to a group, the bot requires that its name be mentioned to activate and respond. Example: "Hi Roboto, how are you?"

Setting Up Your API Keys

Using the .env File

Before you begin using WhatsApp-Claude-GPT, you need to provide your API keys to authenticate requests made to the OpenAI and Anthropic services. This can be done by adding your keys to the .env file in the project root.

Here is an example of the .env file and explanations for each variable:

## OPENAI CONFIG
OPENAI_API_KEY=your_openai_api_key
CHAT_COMPLETION_MODEL=gpt-4o-mini   # Model for chat completions
IMAGE_CREATION_MODEL=dall-e-3       # Model for image generation
SPEECH_MODEL=tts-1                  # Model for speech synthesis
SPEECH_VOICE=nova                   # Voice model for speech synthesis
TRANSCRIPTION_LANGUAGE=en           # The language used for transcribing audio, in ISO-639-1 format (e.g., "en" for English).

## CLAUDE CONFIG
CLAUDE_API_KEY=your_claude_api_key
CLAUDE_CHAT_MODEL=claude-3-sonnet-20240229  # Model for Claude chat interactions

## BOT CONFIG
AI_LANGUAGE=OPENAI                    # Specifies the AI language model to be used. It can be set to either "ANTHROPIC" or "OPENAI".
PREFERRED_LANGUAGE=                   # The default language for the bot. If not specified, the bot will use the language of the chat it is responding to.
MAX_CHARACTERS=2000                   # The maximum number of characters the chat model will output in a single completion
BOT_NAME=Roboto                       # The name the bot will respond to in groups.
MAX_IMAGES=3                          # The maximum number of images the bot can process from the recent messages
MAX_MSGS_LIMIT=30                     # The maximum number of messages the bot will remember and use for generating responses
MAX_HOURS_LIMIT=24                    # The time frame in hours for the bot to consider recent messages
NODE_CACHE_TIME=259200                # Cache time for stored data in seconds (3 days)

IMAGE_CREATION_ENABLED=false           # Enable image creation (OpenAI Only)
VOICE_MESSAGES_ENABLED=false           # Enable voice responses (OpenAI Only)

You can find your OpenAI API key in your OpenAI Account Settings.

You can find your Anthropic API key in your Anthropic Account Settings.

Requirements

Before initializing the bot, make sure you have Node.js installed. (It was tested with Node v18.15.0)

Installation

  1. Clone the repository and navigate to the project directory:
    git clone https://github.com/noDiego/whatsapp-claude-gpt.git
    cd whatsapp-claude-gpt
  2. Install the project dependencies:
    npm install
  3. Set up your API keys in the .env file as described above.

Once the installation and configuration are complete, you are all set to start and enjoy the functionalities of WhatsApp-Claude-GPT.

How to Start

To start the bot, run the following command in the terminal:

npm run start

Upon startup, the bot will display a QR code in the terminal. Scan this QR code using the WhatsApp application on your mobile phone to link the bot to your WhatsApp account.

Using Commands

Creating Images with -image

To generate an image based on text, use the -image command followed by a description of the item you want to create. For example:

-image a nighttime landscape with stars

Example:

Requesting Audio Responses

The bot can now respond with audio messages as well as understand voice messages from users. To request an audio response from the bot, you can include a specific request in your message. For example:

Please respond with an audio message.

Or:

Can you say this as an audio?

Additionally, the bot is capable of processing and understanding voice messages sent by users. It will transcribe and consider the content of these voice messages when generating its responses, ensuring a seamless voice interaction.

Example:

Resetting Chat Context with -reset

The -reset command is designed to clear the chatbot's current conversation context. When you issue this command, it effectively "forgets" the messages that have been processed so far, starting fresh as if the conversation with the user had just begun. This can be particularly useful in scenarios where the conversation has diverged significantly from its original intent or when you wish to start a new topic without the chatbot attempting to maintain continuity with previous messages.

To use the -reset command, simply type and send:

-reset

This command has no additional parameters. Once sent, any subsequent messages will be treated as the beginning of a new conversation, without consideration for what was discussed previously. This can enhance the relevancy and accuracy of the chatbot's responses moving forward.

Updates in Version 1.1.0

With this latest update, the bot has gained the ability to understand and respond to voice messages. Users can now send voice messages to the bot, and it will transcribe and interpret them as part of the conversation. Additionally, if a user requests an audio response, the bot can generate and send a voice message in reply.

Removed Feature:

  • The -speak command has been removed. It is no longer necessary due to the new functionality of handling voice messages directly.

This enhancement improves the bot's interactivity and makes conversations more natural and engaging.

Updates in Version 1.1.1

In this version, we have made the following enhancements:

  • Default Communication Language: A new environment variable, PREFERRED_LANGUAGE, has been introduced. This allows users to specify a default language for the bot to use when communicating. If left empty, the bot will automatically detect and respond in the language of the chat it is replying to.
  • Configuration Management: Users are now required to set configurations in the .env file instead of directly modifying the config/index.ts file. This change aims to simplify the setup process and improve manageability.

Final Notes

Remember that the functionalities like image creation and speech synthesis depend on your access to the OpenAI API and the quotas associated with your account. Ensure your environment is correctly set up and that you have the required quotas to use these features.

Enjoy interacting with your WhatsApp-Claude-GPT!

License

MIT