API pipeline: Set up a Cabi.Chat widget that Cabi.Chat's AI runs

Index: API pipelines — index

Goal: a Cabi.Chat widget answers people in its Cabi.Chat rooms under your agenda. Cabi.Chat runs it; no server and no token of yours. What a widget is and who can reach it: Cabi.Chat Oracles — Cabi.Chat widget

Steps

1. Have an agenda with the widget's instructions: API pipeline: Write an agenda for your oracles

2. Create.

POST /v0/my/oracles
Idempotency-Key: widget-bakery-1
{"kind": "cabi_widget", "hosting": "platform", "title": "Bakery desk",
 "agenda": "<agenda nonce>", "project": "<project nonce>",
 "visibility": "Public", "publicity": "Ecosystem",
 "permissions": {"read": true, "write": false, "execute": false}}
→ {"nonce": "470000000000000003", "card_type": "oracle", "kind": "cabi_widget", "status": "STOPPED", …}

3. Start.

POST /v0/my/oracles/470000000000000003/start
→ {"success": true, "status": "ACTIVE"}

4. A person opens a conversation with it, signed in. They speak as their first project, so they need at least one project:

POST /v0/my/rooms/widget
{"widget": "470000000000000003"}
→ {"nonce": "470000000000000700", "card_type": "room", …}

The room is the person's own private chat with the widget, with threads when topics_in_private is on. The same call returns the existing room when there is one. Then they write with POST /v0/my/rooms/{ident}/talk/send {"text": "…"}, and the widget answers in the room. Reading and answering rooms: API pipeline: Read and answer your conversations

5. Follow along. Every room of your widget is in GET /v0/my/rooms. You can post in it yourself: as your own project when the person on the other side is one of your projects, otherwise as the widget: API pipeline: Supervise conversations your oracles hold: turn the listener off/on, clear a handoff, set a room's agenda, ask the oracle to continue

Rules

API surface

Endpoint Purpose FE AI / oracle
POST /v0/my/oracles Create the widget yes yes
PATCH /v0/my/oracles/{nonce} Agenda, project, title, visibility, topics_in_private yes yes
POST /v0/my/oracles/{nonce}/start, /stop Run / stop yes yes
POST /v0/my/rooms/widget Open a conversation with a widget the Cabi.Chat Assistant only yes
GET /v0/my/rooms The widget's conversations yes yes
POST /v0/my/oracles/{nonce}/regenerate-token A new token, kept by Cabi.Chat no no
DELETE /v0/my/oracles/{nonce} Stop and delete yes rarely

Mentioned