Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yehuda-lev/whatsgrambot
WhatsGram - Managing a WhatsApp bot (official) in a Telegram topics group.
https://github.com/yehuda-lev/whatsgrambot
pyrogram pywa whatsapp-bot whatsapp-bot-support whatsapp-cloud-api whatsgrambot
Last synced: about 1 month ago
JSON representation
WhatsGram - Managing a WhatsApp bot (official) in a Telegram topics group.
- Host: GitHub
- URL: https://github.com/yehuda-lev/whatsgrambot
- Owner: yehuda-lev
- License: mit
- Created: 2024-05-01T10:24:43.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-08-15T17:30:37.000Z (3 months ago)
- Last Synced: 2024-08-16T19:13:23.187Z (3 months ago)
- Topics: pyrogram, pywa, whatsapp-bot, whatsapp-bot-support, whatsapp-cloud-api, whatsgrambot
- Language: Python
- Homepage:
- Size: 113 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WhatsGramBot
## Description
WhatsGramBot is a Python bot primarily designed for managing a bot on WhatsApp. It utilizes a Telegram group to organize WhatsApp Chats according to topics, enhancing the management of WhatsApp conversations.
### Features:
1. User-Based Messaging Organization:
- Each WhatsApp user is assigned a dedicated topic within a Telegram group.
- Messages from WhatsApp users are forwarded to their respective topics within the Telegram group.
- Telegram group administrators can respond to messages from WhatsApp within the Telegram group, facilitating collaborative communication.2. Settings Configuration (/settings command):
- Enable or disable welcome messages and customize their content.
- Toggle automatic topic creation when a user opens a chat with the bot on WhatsApp. When enabled, a welcome message and topic creation occur immediately upon chat opening, even if the user hasn't sent a message yet.
- Toggle mark messages as read as soon as new replies are sent to the user on WhatsApp.3. Information Retrieval (/info command):
- Obtain details about specific user topics and their configurations.## Setup
1. Clone the repository
```bash
git clone https://github.com/yehuda-lev/WhatsGramBot.git
```## Setting up Environment Variables
To set up the environment variables for the project, follow these steps:
1. **Copy the `.env.example` file:**
```bash
cp .env.example .env
```1. **Edit the `.env` file:**
- Open the `.env` file in a text editor of your choice.
- Replace the placeholder values with your actual credentials. You can obtain these credentials from the following sources:- **Telegram Credentials:**
- `TG_API_ID` and `TG_API_HASH`: Obtain from [my.telegram.org](https://my.telegram.org).
- `TG_BOT_TOKEN`: Create a new bot on [BotFather](https://t.me/BotFather).
- `TG_GROUP_TOPIC_ID`: ID of the Telegram group where the bot will operate.- **WhatsApp Credentials:**
- `WA_PHONE_ID`, `WA_BUSINESS_ID`, `WA_VERIFY_TOKEN`, `WA_TOKEN`, `WA_PHONE_NUMBER`: Create a WhatsApp application following the guide [here](https://pywa.readthedocs.io/en/latest/content/getting-started.html#create-a-whatsapp-application).
- `WA_APP_ID` and `WAAPP_SECRET`: Obtain from your Facebook developers account under "App Settings" > "Basic". Access all your apps [here](https://developers.facebook.com/apps/).
- `WA_CALLBACK_URL`: URL for the webhook to receive incoming messages from WhatsApp. You can use a service like [ngrok](https://ngrok.com/) to create a secure tunnel to your local server.
- `WEBHOOK_ENDPOINT`: Endpoint to register the webhook for the bot (will become `WA_CALLBACK_URL/WEBHOOK_ENDPOINT`)
- **General Settings:**
- `PORT`: Port number to run the server on (default is 8080).
- `DEBUG`: Set to `true` to enable debug mode, which logs additional information to the console (default is `false`).
- `HTTPX_TIMEOUT`: Timeout for HTTP requests in seconds. change if running on a slow network or server (default is 15.0 seconds).2. **Save the `.env` file:**
- After editing, save the changes to the `.env` file.By completing these steps, your environment variables will be properly configured for the project.
## Installation
Clone the repository to your local machine. Then, build the Docker image using the following command:
> If you want to rebuild the image, you can use the `--build` flag to force a rebuild:
> If you want to run the bot in the background, you can use the `-d` flag:
```bash
docker compose up
```## Credits
This project was created by [@yehudalev](https://t.me/yehudalev).## Screenshots
Telegram Group (Desktop)
![image](https://telegra.ph/file/ef167f2274e4a2c5f9cbc.jpg)
WhatsApp Chat (Mobile)
![image](https://telegra.ph/file/5c3aea0fed399835811a3.jpg)
Telegram Group (Mobile)
![image](https://telegra.ph/file/dfa2e440fa513dee955ad.jpg)
WhatsApp Chat (Desktop)
![image](https://telegra.ph/file/3c019201964436a4e21c3.jpg)