An open API service indexing awesome lists of open source software.

https://github.com/offchainlabs/telegram-slack-bot


https://github.com/offchainlabs/telegram-slack-bot

Last synced: 3 months ago
JSON representation

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:

![UI Screenshot](ui-interface.png)

### 🧩 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`.