Room bots
A room bot posts cards into rooms on its own, from your server: news, alerts, reminders or build results. It never reads the room.
Setting it up
- Add
"roomBot": trueto the manifest and publish it. - On the app's Room bot tab, choose Issue token. The token starts with
bbt_and is shown only once; only a hash of it is stored. Issuing a new one stops the old one at once. - A room's admin adds your app to the room. Apps cannot be added to end-to-end encrypted rooms, and the app must be active and published.
- The Room bot tab lists the rooms your app is in, with their ids.
Posting a card
curl -X POST "https://dev.banga.chat/bot-api/v1/rooms/ROOM_ID/cards" \
-H "Authorization: Bearer bbt_..." \
-H "Content-Type: application/json" \
-d '{
"blocks": [
{ "type": "title", "text": "Server maintenance tonight" },
{ "type": "facts", "items": [ { "k": "From", "v": "22:00 UTC" }, { "k": "To", "v": "23:00 UTC" } ] }
],
"actions": [ { "type": "open_url", "label": "Status page", "url": "https://status.example.com" } ]
}'
The body is a card's blocks and actions, checked against the
card rules and your manifest's allowed hosts and flows. The answer is
201 with {"messageId": ...}. The card is signed and posted with your app's name on it.
Its buttons run as whoever taps them, like any card.
| Status | Meaning |
|---|---|
201 | Posted. |
400 | The card breaks the rules (the message lists what), or there is no such room. |
401 | The token is missing or unknown. |
403 | The app is not in the room, is not active, has nothing published, or does not declare
roomBot. |
429 | More than 10 cards into one room within 60 seconds. |
Errors are JSON with a message explaining the problem. A room's admin can remove your app from the room
at any time.