{% extends "layouts/workspace_settings.html" %} {% load common_extras %} {% comment %} Connect a Telegram bot — the shape all six connect pages share: a hero carrying the platform's own mark, the numbered sequence of things to do somewhere else, the credential form, what happens after Connect, and the way back. {% templatetag openblock %} block content_wrap {% templatetag closeblock %} is cleared because this page brings its own cards; layouts/settings.html only wraps pages still written as bare semantic HTML. The h1 moved out of page_header for the same reason channels/list.html moved its — the mark and the title are one unit, and that block renders above the card. The platform key is written once, into {% templatetag openblock %} with {% templatetag closeblock %}, so the chip class and the glyph cannot drift apart. Never build the chip class by hand as pi-{{ key }}: an unrecognised key then produces a class no stylesheet defines and .pi-chip's white glyph disappears against the card. The filter falls back to pi-unknown, which is visible. Full setup notes live in docs/channels/telegram.md — a note to ourselves, so it stays in here rather than on the page. {% endcomment %} {% block title %}Connect Telegram · DemandTrail Messaging{% endblock %} {% block content_wrap %}{% endblock %} {% block content %} {% with platform_key="telegram" %}
{% include "partials/_platform_icon.html" with platform=platform_key size="lg" only %}

Connect a Telegram bot

Telegram bots are created by talking to BotFather. The token it gives you is the whole credential: anyone holding it can read and send as your bot, so it is stored encrypted and never shown again.

{% comment %} The text goes straight into the alert div. Wrapping it in a

paints it grey: .alert-error sets its colour on the wrapper, and .app-content p in @layer base sets one directly on the

, which beats an inherited value. {% endcomment %} {% if error %}

{{ error }}
{% endif %}

Before you paste

  1. Open @BotFather in Telegram and send /newbot.
  2. Choose a display name and a username ending in bot.
  3. Copy the token it replies with. It looks like 123456789:AA….
{% csrf_token %}

Paste the token

{% comment %} autocomplete="off" and a password input: this value is a live credential and must not end up in the browser's saved form data. It is never rendered back either, so there is no value attribute here and there never will be. {% endcomment %}

Pasted once. We verify it with Telegram before saving anything.

What happens next

We call getMe to check the token and learn your bot's username, then point Telegram at this deployment with setWebhook and a secret only the two of us know.

{% include "partials/_copy_field.html" with label="Deliveries arrive at" value=webhook_url hint="That URL has to be reachable from the public internet over HTTPS with a valid certificate. Telegram will not deliver to anything else. On a local machine, put a tunnel in front of it first. Full setup notes are in docs/channels/telegram.md." only %}
Back to channels
{% endwith %} {% endblock %}