Skip to content

retttddd/jenkins-telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram-post-bot

Minimal Telegram bot backend that broadcasts any POST body to subscribed users.

What it does

  1. User sends /start to your Telegram bot.
  2. Telegram delivers updates to /telegram/webhook.
  3. Any service posts to /webhook.
  4. The server broadcasts the payload to every subscribed chat.
  5. /help shows commands and endpoints.
  6. /stop unsubscribes a user.

Environment

Variable Required Description
TELEGRAM_BOT_TOKEN yes Telegram bot token
WEBHOOK_BASE_URL recommended Public base URL of the deployed app, for example https://your-app.example.com
PORT no Defaults to 3000

PUBLIC_URL also works if present.

Quick start

cp .env.example .env
bun install
bun run start

Telegram setup

The app sets the Telegram webhook automatically on startup.

If you want to set it manually:

curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://your-app.example.com/telegram/webhook"}'

Then send /start to subscribe, /help for info, or /stop to unsubscribe.

Send updates

Send any text or JSON payload to:

curl -X POST https://your-app.example.com/webhook \
  -H 'Content-Type: application/json' \
  -d '{"status":"SUCCESS","message":"Build finished"}'

Jenkinsfile

stage('notify') {
  steps {
    sh "curl -X POST https://your-app.example.com/webhook \
      -H 'Content-Type: application/json' \
      -d '{\"job\":\"${env.JOB_NAME}\",\"buildNumber\":\"${env.BUILD_NUMBER}\",\"result\":\"${currentBuild.currentResult}\"}'"
  }
}

Notes

  • Subscriber chat IDs are stored in subscribers.json.
  • Use persistent storage if you want subscriber data to survive restarts.

About

jenkins tg bot

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors