Key and access
Keys are created in the bot settings, in the “API keys” section. The section is available to administrators.Create a key
Open “Bot settings” → “API keys” → “Add API key”. Choose the permissions, set a name and press “Generate”.
Copy the value
Copy the key and paste it into your request. The value can always be viewed later with the copy button in the list.
A read-only key will not work for starting a funnel. Starting needs the “Start the bot” permission.
Authorization header:
Get a subscriber
Returns the data of this bot’s subscriber: name, username, tag, variables and subscription date.- Method and path:
GET /subscribers/{telegram_id} - Permission: “Read subscriber information”
telegram_id, a 404 response arrives.
Start a funnel with a callback
Sends a callback into the bot on the subscriber’s behalf, as if they had pressed an inline button. That is how you start the branch of the funnel you need from your own service.- Method and path:
POST /fire-callback - Permission: “Start the bot”
Repeated requests
If your service repeats a request on a timeout or a dropped connection, add anIdempotency-Key header with your
own unique value per operation:
A callback does not create a subscriber. If the subscriber does not exist in the target bot yet, the
callback waits and fires once they message the bot, for up to 14 days. If the bot is
off, its block on this callback adds and removes tags and sends API requests, but
sends no messages to the subscriber, and the callback does not wait for a subscriber who is not in the bot yet.
What happens to an unmatched
callback, and which variables are available in the target bot, is described under
Constructor, the “Another bot” action. A funnel started through the API cannot
fire a callback in another bot.
Errors
On an error you get the matching response code and a body with an explanation.What’s next
Flow builder
Blocks, conditions and the “Send API request” action, which can also send a callback.
Variables
Which subscriber data is available and what it is called.