Send scheduled Telegram messages from a bot
Send messages from your Telegram bot to a chat, group, or channel on a schedule: daily briefs, reminders, and alerts, filled in from any API. cronservices calls the Bot API, so you don't need to keep the bot running.
Example: a morning weather brief for a crew
json
{
"name": "Crew weather brief",
"cron": { "expression": "30 5 * * 1-6", "time_zone": "America/Los_Angeles" },
"nodes": [
{ "id": "forecast", "open_meteo_forecast": { "latitude": "45.52", "longitude": "-122.68", "units": "imperial" } },
{ "id": "text", "telegram_send_message": {
"credential_id": "YOUR_TELEGRAM_BOT_ID",
"chat_id": "-1001234567890",
"text": "Today: {{ $.daily.temperature_2m_min[0] }}–{{ $.daily.temperature_2m_max[0] }}°F, {{ $.daily.precipitation_sum[0] }} in of rain." } }
]
}Set up
- Create a bot with @BotFather and save its token as a
telegram_botcredential in Settings → Credentials. - Add the bot to the group or channel. For a channel, make it an admin.
- Find the chat id: send a message in the chat, then open
https://api.telegram.org/bot<token>/getUpdates. Group ids are negative. For a public channel,@channelusernameworks too.
Reference
Send a Telegram message: telegram_send_message
Sends POST https://api.telegram.org/bot<token>/sendMessage. Output for the next step: Telegram’s response, with the sent message in result.
| Field | Type | Notes |
|---|---|---|
credential_id |
string, required | The id of a telegram_bot credential holding the token from BotFather. |
chat_id |
string, required | A numeric chat id (negative for groups), a @channelusername, or a placeholder. |
text |
string, required | Up to 4,096 characters. Placeholders allowed. |
More ideas
- A daily reminder to take medication at 08:00 local:
0 8 * * *. - Today's exchange rate in a family group chat.
- A one-time reminder the evening before an event, with
run_at.