https://github.com/machsix/telegram_to_bark
Use [Bark](https://github.com/Finb/Bark) to push notifications for sideloaded telegram
https://github.com/machsix/telegram_to_bark
bark telegram
Last synced: 4 days ago
JSON representation
Use [Bark](https://github.com/Finb/Bark) to push notifications for sideloaded telegram
- Host: GitHub
- URL: https://github.com/machsix/telegram_to_bark
- Owner: machsix
- License: mit
- Created: 2026-05-03T20:55:11.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2026-05-05T04:06:14.000Z (2 months ago)
- Last Synced: 2026-05-05T06:18:04.824Z (2 months ago)
- Topics: bark, telegram
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Telegram to Bark
A self-hosted Telegram userbot that forwards incoming messages as push notifications to [Bark](https://bark.day.app) (iOS).
## Features
- **Message forwarding** — forwards incoming text and media messages to your Bark endpoints
- **Activity suppression** — skips notifications while you are actively using Telegram (configurable idle timeout)
- **Archive filter** — ignores messages from archived chats, reloaded every hour
- **Mute filter** — respects Telegram's per-chat and global mute/silent notification settings
- **Image upload** — uploads favicon of the chat to an image hosting service and includes the URL in the notification so that Bark can display it as an icon; supports [tmpfiles.org](https://tmpfiles.org) (no key) and [ImgBB](https://imgbb.com) (free API key)
## Running
### Docker (recommended)
Place your `config.json` inside a `config/` folder next to `docker-compose.yml`, then:
```bash
docker compose up -d
```
The container auto-detects `/app/config/config.json` (mounted from `./config`).
Pull a pre-built image:
```bash
docker run -v ./config:/app/config ghcr.io//telegram_to_bark:latest
```
Force a clean rebuild:
```bash
docker compose build --no-cache
```
### Local
```bash
pip install -r requirements.txt
python telegram_bark_client.py
# or point to a config directory:
python telegram_bark_client.py --config-dir /path/to/config
```
Config is auto-detected in this order: current working directory → `/config` → `/app/config`.
## Setup
Run the interactive wizard to create `config.json` and generate a Telegram session string:
```bash
python init.py
# or for a specific directory:
python init.py --config-dir ./config
```
The wizard walks through all sections: Telegram credentials, Bark endpoints, activity timeout, logging, and image cache backend.
## Configuration
`config.json` (JSONC — `//` comments supported):
```jsonc
{
"telegram": {
"api_id": 12345678, // from https://my.telegram.org/apps
"api_hash": "your_api_hash",
"phone_number": "+1234567890",
"session_string": "" // filled in by init.py
},
"bark": {
"endpoints": [
"https://api.day.app/YOUR_BARK_KEY"
],
"group": null, // notification group name (optional)
"sound": null // notification sound (optional)
},
"activity": {
"timeout_seconds": 300 // suppress notifications for this many seconds after last activity
},
"logging": {
"level": "INFO",
"file": null // path to log file (optional)
},
"image_cache": {
"backend": "tmpfiles", // "tmpfiles" or "imgbb"
"imgbb_api_key": null, // required when backend is "imgbb"
"expiration_days": 7,
"db_path": "image_cache.db"
}
}
```
### Image cache backends
| Backend | Key required | Notes |
|---|---|---|
| `tmpfiles` | No | Files expire after the configured days; URLs are direct download links |
| `imgbb` | Yes (free at [imgbb.com](https://api.imgbb.com)) | Persistent hosting with expiration support |
## Requirements
- Python 3.11+
- Telegram API credentials from [my.telegram.org/apps](https://my.telegram.org/apps)
- [Bark](https://apps.apple.com/app/bark-customed-notifications/id1403753865) installed on your iPhone