-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance logging and configuration for WhatsApp integration
- Added logging for processed responses and character count in classifier. - Implemented truncation for results exceeding 2499 characters. - Expanded .env.example with additional configuration options for WhatsApp bot. - Updated README.md for clearer setup instructions and usage guidelines.
- Loading branch information
Showing
3 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,37 @@ | ||
TRIGGER_SECRET_KEY= | ||
TRIGGER_API_URL= | ||
MONGODB_URI= | ||
PORT=4000 | ||
PUPPETEER_EXECUTABLE_PATH="/snap/bin/chromium" | ||
|
||
|
||
# This is how the bot will prefix its messages when answering to commands | ||
# or when replying to itself (e.g. when you run the bot in your own personal whatsapp account) | ||
# Note: must be different from CMD_PREFIX and cannot be empty | ||
BOT_PREFIX="*[BOT]:*" | ||
|
||
# This is how the user should prefix their messages when issuing commands to the bot | ||
CMD_PREFIX="!" | ||
|
||
# The assistant's name. Call it whatever you want. | ||
BOT_NAME="Sydney" | ||
|
||
# Accepted values are "true", "dms_only", "groups_only" or "false" | ||
ENABLE_REACTIONS="true" | ||
|
||
# The bot will only reply to these users. Leave this commented to allow everyone to use the bot. | ||
# See the readme.md file to learn how this works. | ||
#ALLOWED_USERS="" # Example: "5511999999999,14155551111" where 55 is the country code, 11 is the area code, and the rest is the phone number. | ||
|
||
# The bot will ignore these users. Leave this commented to allow everyone to use the bot. | ||
# See the readme.md file to learn how this works. | ||
#BLOCKED_USERS="" # Example: "5511999999999,14155551111" where 55 is the country code, 11 is the area code, and the rest is the phone number. | ||
|
||
# The "Too many unread messages..." warning when the bot starts. | ||
IGNORE_MESSAGES_WARNING="false" # Accepted values are "true" or "false" | ||
|
||
# Change to your liking | ||
QUEUED_REACTION="🔁" | ||
WORKING_REACTION="⚙️" | ||
DONE_REACTION="✅" | ||
ERROR_REACTION="⚠️" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,53 @@ | ||
# ai-whatsapp | ||
|
||
A WhatsApp integration module for the Earth Defenders Assistant platform using Baileys library. | ||
|
||
## Requirements | ||
|
||
- [Bun](https://bun.sh) v1.1.24 or higher | ||
- Node.js environment | ||
- WhatsApp account with an active phone number | ||
|
||
## Environment Setup | ||
|
||
1. Create a `.env` file in the root directory by copying `.env.example`: | ||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
2. Configure the environment variables in your `.env` file. | ||
|
||
## Installation | ||
|
||
To install dependencies: | ||
|
||
1. Go into the repo's main folder `./earth-defenders-assistant` and use: | ||
```bash | ||
bun install | ||
``` | ||
|
||
To run: | ||
|
||
2. Then use: | ||
```bash | ||
bun run index.ts | ||
bun dev:whatsapp | ||
``` | ||
|
||
This project was created using `bun init` in bun v1.1.24. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. | ||
## First-time Setup | ||
|
||
1. When you first run the application, a QR code will appear in your terminal | ||
2. Scan this QR code with your WhatsApp mobile app | ||
3. Wait for the authentication process to complete | ||
4. The bot will be ready to receive and process messages once connected | ||
|
||
## Usage | ||
|
||
- Use the configured `CMD_PREFIX` (default: "!") to send commands to the bot | ||
- The bot will respond with messages prefixed with the configured `BOT_PREFIX` | ||
- Reactions can be enabled/disabled using the `ENABLE_REACTIONS` setting | ||
|
||
## Project Structure | ||
|
||
This project is part of the Earth Defenders Assistant platform and uses: | ||
- `@whiskeysockets/baileys` for WhatsApp integration | ||
- Trigger.dev for workflow automation | ||
|
||
For more information about the Earth Defenders Assistant platform and its components, please refer to the main project documentation. |