Skip to content

Telegram

Telegram connects over the Bot API with long polling. Webhook mode is not implemented.

Setting it up

  1. Talk to @BotFather, send /newbot, and copy the token.

  2. Store it — the config file holds only the name of a secret:

    Terminal window
    printf '%s' '123456:ABC-DEF...' | nouride secret set telegram-nouva --value-stdin
  3. Add the connection:

    [gateways.telegram.nouva]
    enabled = true
    token = "telegram-nouva"
    agent = "nouva"
    mode = "polling"
  4. Restart the daemon, then message the bot.

Or do all of it from the dashboard: Agents → your agent → Connections.

An agent answering in Telegram

Groups: privacy mode

By default, Telegram does not deliver group messages your bot was not addressed in. Not the daemon — Telegram. Two ways to change that:

  • BotFather → /setprivacyDisable, or
  • make the bot a group admin.

Until one of those is true, group_context_messages has nothing to work with and the agent sees only messages that mention it. Which is a perfectly reasonable setting — just not the one people expect when they turn context on.

Inline approvals

When an agent stops to ask permission, the request arrives in the chat with Approve and Deny buttons. Tapping one answers it.

The text commands work too, and are what you want on a phone keyboard:

/approve
/approve always
/deny

Approvals →

The command menu

/commands

Pushes the daemon’s slash-command list into Telegram’s native menu for that bot, so the people using it do not have to know any of them. Worth running once per bot.

The list is generated from the same registry that answers the commands, because a list typed out a second time is a list that goes stale.

Reconnection

[gateways.telegram.nouva.resilience]
max_reconnect_attempts = 10
reconnect_backoff_ms = 1000
reconnect_backoff_max_ms = 60000
reconnect_backoff_multiplier = 2
health_check_interval_ms = 30000

A connection that exhausts its attempts is marked dead and raises an alert — if you configured somewhere for alerts to go. Otherwise it is a line in the log, and you find out when you notice the agent has gone quiet.

Terminal window
nouride gateway # status of every connection
nouride gateway restart telegram:nouva

Several Telegram bots

One connection per agent, each with its own token and its own @username:

[gateways.telegram.nouva]
enabled = true
token = "telegram-nouva"
agent = "nouva"
[gateways.telegram.nox]
enabled = true
token = "telegram-nox"
agent = "nox"

In a group holding both, addressing becomes required — a message naming nobody is answered by nobody, rather than by both. Why, and what counts as addressing →

Restricting who can use it

Access is handled by the daemon, not by Telegram. By default a stranger gets a pairing code and waits.

Terminal window
nouride access
nouride access approve <code>

Who may talk to it →