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

  1. Add "roomBot": true to the manifest and publish it.
  2. 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.
  3. 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.
  4. 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.

StatusMeaning
201Posted.
400The card breaks the rules (the message lists what), or there is no such room.
401The token is missing or unknown.
403The app is not in the room, is not active, has nothing published, or does not declare roomBot.
429More 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.