Telegram

Send messages and manage Telegram bots via the Bot API.

thinkfleetai Updated 358 repo stars

File contents

Telegram Bot

Send messages and manage bots via the Telegram Bot API.

Environment Variables

  • TELEGRAM_BOT_TOKEN - Bot token from @BotFather

Send message

curl -s -X POST \
  "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":"CHAT_ID","text":"Hello from ThinkFleetBot!"}' | jq '{ok, result: {message_id, chat: .result.chat.title}}'

Get updates

curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates?limit=10" | jq '.result[] | {update_id, message: {from: .message.from.username, text: .message.text}}'

Get bot info

curl -s "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getMe" | jq '.result'

Send photo

curl -s -X POST \
  "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendPhoto" \
  -F "chat_id=CHAT_ID" -F "photo=@/path/to/photo.jpg" -F "caption=Photo caption" | jq '{ok}'

Notes

  • Always confirm before sending messages.
  • Get chat_id from getUpdates after sending a message to the bot.

thinkfleetai/thinkfleet-engine commit 86f88aefdb

Frequently asked questions

npx get-skill add thinkfleetai/telegram