Telegram
Telegram is the fastest path for local development. Without a public HTTPS URL,
Greenlight uses long polling. When PUBLIC_WEBHOOK_URL is set, Greenlight
calls setWebhook automatically.
1. Create a bot
- Message @BotFather
- Send
/newbotand follow the prompts - Copy the bot token (
123456789:AAH…)
Keep the token out of git — paste it only into Greenlight.
2. Add the bot to a chat
Group (recommended for prompts)
- Create or open a group
- Add the bot
- Optionally promote it to admin if it must see all messages
Private chat
- Open the bot and press Start
- Use your user ID as
target_chat_id
3. Get target_chat_id
- Forward a group message to
@userinfobot/@getidsbot, or - Send a message, then open
https://api.telegram.org/botTOKEN/getUpdatesand read"chat":{"id": -100…}(negative for groups)
4. Register the channel
curl -X POST http://localhost:8100/v1/channels/new \
-H "X-API-Key: $GREENLIGHT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "my-telegram-prompts",
"platform": "telegram",
"target_chat_id": "-1001234567890",
"credentials": { "bot_token": "YOUR_BOT_TOKEN" },
"channel_type": "PROMPT"
}'Credentials
| Field | Required |
|---|---|
bot_token | Yes |
5. Webhook URL
{PUBLIC_WEBHOOK_URL}/webhooks/{organization_id}/telegram/{channel_id}Local .env with PUBLIC_WEBHOOK_URL=http://localhost:8100 is fine for polling.
Troubleshooting
| Problem | Fix |
|---|---|
AuthenticationError / AUTH_FAILED | Invalid bot_token — recreate with BotFather |
| Bot silent in group | Add bot to group; confirm target_chat_id |
| No updates | Ensure the bot can see messages (privacy mode / admin) |