https://github.com/techprober/telegram-webhook-forwarder-bot
https://github.com/techprober/telegram-webhook-forwarder-bot
serverless telegram-bot
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/techprober/telegram-webhook-forwarder-bot
- Owner: techprober
- License: mit
- Created: 2022-10-14T10:36:09.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-21T15:28:07.000Z (over 3 years ago)
- Last Synced: 2025-01-16T13:57:49.836Z (over 1 year ago)
- Topics: serverless, telegram-bot
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
💬 Telegram Webhook Forwarder Bot
ChatOps as a Service
## Introduction
CopyRight 2022 TechProber. All rights reserved.
Maintainer: [ Kevin Yu (@yqlbu) ](https://github.com/yqlbu)
The `telegram-webhook-forwarder-bot` forwards any incoming webhooks to the target telegram chat.
The bot is written in Python with Web Server Gateway Interface (WSGI) and Flask
## Prerequisites
Install depedencies
```bash
./install
```
Configure Environment with `.env`
```
# .env
API_TOKEN=
CHAT_ID=
WEBHOOK_PATH=
PORT=
```
Notes:
- `API_TOKEN` can be obtained by [BotFather](https://t.me/botfather?start=botostore)
- `CHAT_ID` can be obtained by sharing the chat to the [IDBot](https://t.me/username_to_id_bot?start=botostore)
- `WEBHOOK_PATH` is the api endpoint as part of the webhook url. e.g. `/webhook/hello`
- `PORT` is the port that the server listens to when running the bot locally
## Usage
Activate the virtual environment
```bash
# bash
. ./venv/bin/activate
# fish
. ./venv/bin/activate.fish
```
Spin up the local server for debugging
```bash
python3 server.py
```
## Deploy
This bot can be hosted as a serverless function. e.g hosted on [Vercel](https://vercel.com/)
```bash
# install vercel client (cli)
npm -g install vercel
# login and authenticate
verlcel
# publish a new deployment and automatically promote it to production
vercel --prod
```
## References
- [Github - pyTelegramBotAPI](https://github.com/eternnoir/pyTelegramBotAPI)
- [Vercel Advanced Python Usage - Web Server Gateway Interface](https://vercel.com/docs/runtimes#advanced-usage/advanced-python-usage/web-server-gateway-interface)