https://github.com/offchainlabs/telegram-slack-bot
https://github.com/offchainlabs/telegram-slack-bot
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/offchainlabs/telegram-slack-bot
- Owner: OffchainLabs
- Created: 2025-02-28T23:33:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-13T21:16:19.000Z (3 months ago)
- Last Synced: 2026-03-14T09:39:36.628Z (3 months ago)
- Language: Python
- Size: 276 MB
- Stars: 2
- Watchers: 9
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π TelegramSlackApp
A cross-platform desktop tool built with **PyQt6** and **asyncio** for broadcasting messages (optionally with images) to **Telegram groups/channels** and **Slack channels** β with optional **Notion integration** for managing groups via tags.
- β
Built with PyQt6 for native GUI experience
- β
Sends messages to Telegram & Slack
- β
Supports image attachments
- β
Optional: Pull groups from a Notion database using tags
- β
Easy to install (.pkg for macOS)
---
## πΈ User Interface Overview
Here's what the app looks like on macOS:

### π§© Interface Breakdown
| Section | Description |
|--------|-------------|
| **Telegram API & Hash** | Your Telegram API credentials (from [my.telegram.org](https://my.telegram.org)). Required for authentication. |
| **Slack Token** | A Slack bot token used to send messages via Slack API. |
| **Telegram Groups / Channels** | Text fields where you can list Telegram group names or channel IDs to send messages to. |
| **Slack Channels** | List of Slack channels (e.g., `#general`, `#alerts`) to send messages to. |
| **Use Notion groups instead of manual input** | Check this box to automatically pull and target Telegram/Slack groups based on category tags stored in your Notion database. |
| **Notion API Token** | Your Notion integration token, used to authenticate and fetch tags/groups. |
| **Tags (from Notion)** | A checklist that auto-populates with category tags fetched from your Notion database. Select multiple to filter groups/channels. |
| **π Load Tags from Notion** | Fetches tags from the connected Notion database and populates the tag list below. Use this after entering your Notion token. |
| **Notion Message Page URL** | Just copy paste the URL of the Notion page contains the message and image. |
| **π Load Content** | Giving the URL to the app, by clicking on this button you can see the message and image preview |
| **Send to Telegram / Slack** | Buttons to dispatch the message to your selected platforms. |
---
## π§ Installation & Usage
### π» Option 1: Run from source (Mac/Linux)
```bash
# Clone the repository
git clone https://github.com/yourusername/TelegramSlackApp.git
cd TelegramSlackApp
# Run setup script
bash run_app.sh
```
This script:
- Checks for Python 3 and installs it if missing
- Creates a virtual environment
- Installs required dependencies from `requirements.txt`
- Launches the app
### πͺ Option 2: Run on Windows
Double-click or run:
```bat
run_app.bat
```
Make sure you have Python 3 and pip installed. The `.bat` script mirrors the bash setup.
### π Option 3: Install on macOS via .pkg
Build a macOS `.pkg` installer locally using `py2app` and `pkgbuild`.
> **Note:** The `.pkg` installer is not included in the repository due to GitHub's file size restrictions.
> To install the app on your Mac, you can build the `.pkg` yourself using the steps below.
---
## π¦ Packaging (Advanced)
To build your own `.pkg` installer (macOS only):
1. Convert the Python script to `.app` using `py2app`:
```bash
python3 setup.py py2app
```
2. Run the packaging script (weβll include this soon) to:
- Move the app bundle into `pkg-root/Applications`
- Make it non-relocatable
- Generate `component.plist`
- Create final `.pkg` file using `pkgbuild`
***We already have a script to create package after changing app or ui. You can bash script by this command:***
```bash
./build.sh
```
---
## π§ Project Structure
```
TelegramSlackApp/
β
βββ app.py # Main application logic
βββ ui_mainwindow.py # PyQt6-generated GUI file
βββ ui_mainwindow.ui # Original Qt Designer file
βββ setup.py # py2app build script
βββ requirements.txt # Python dependencies
βββ run_app.sh # Shell script for Linux/macOS
βββ run_app.bat # Windows runner
βββ README.md # This file
βββ (pkg-root/, dist/, build/) # Generated during build
```
---
## π§ Features
- π€ Send messages to multiple Telegram groups/channels and Slack channels simultaneously
- πΌοΈ Optionally attach an image
- π§ Intelligent channel selection via **Notion tags**
- π OAuth-free authentication using Telegramβs API ID + API Hash
- π Retry-safe Telegram client with session caching
---
## π‘ Notion Integration
To use Notion-based message routing:
1. Create a Notion integration: [https://www.notion.so/my-integrations](https://www.notion.so/my-integrations)
2. Share your target database with the integration
3. Use this schema in your DB:
| Property | Type |
|------------------|---------------|
| Platform | Select (`Telegram` / `Slack`) |
| Category | Multi-select (tags like "Exchanges", "Validators") |
| Contact Name / Channel ID | Text (e.g., Telegram channel username or Slack channel ID) |
4. To fetch message from Notion, you need to copy paste URL in the ```Use Notion groups instead of manual input``` field.
---
## π οΈ Development
Make sure to activate your virtual environment:
```bash
source venv/bin/activate # or use your IDEβs interpreter
```
Then run:
```bash
./run_app.sh
```
> β οΈ Note: Build artifacts like `.pkg`, `.app`, `dist/`, and `build/` are excluded from version control via `.gitignore`.