Connect the sandbox's agent to Telegram, Slack, WhatsApp or a webhook
const url = 'https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/connections';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"kind":"telegram","name":"example","bot_token":"example","app_token":"example","phone_number_id":"example","access_token":"example","app_secret":"example","app_id":"example","tenant_id":"example","reply_url":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/connections \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "kind": "telegram", "name": "example", "bot_token": "example", "app_token": "example", "phone_number_id": "example", "access_token": "example", "app_secret": "example", "app_id": "example", "tenant_id": "example", "reply_url": "example" }'The platform holds the connection while the sandbox sleeps (ADR 0032): what arrives is kept, the sandbox is woken, each chat gets its own agent conversation, and the agent’s reply is sent back. Tokens are checked with their platform, then sealed in the region; they never enter the sandbox.
- telegram:
bot_tokenfrom @BotFather. Chats join by openingpair_link. - slack:
bot_token(xoxb-) and an app-levelapp_token(xapp-) with socket mode on. The bot answers direct messages and mentions, in threads. - whatsapp:
phone_number_id,access_tokenandapp_secretfrom Meta. Setwebhook_urlandverify_tokenas the app’s webhook, subscribed to messages. Chats join by openingpair_link. - webhook: POST messages to
webhook_urlwithsecretas a bearer token (shown once). Replies go toreply_url, if set, signed like Stillbox’s webhooks.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Defaults to the bot’s name, the Slack workspace or the number.
Telegram’s bot token, Slack’s bot token (xoxb-), or Discord’s bot token.
Slack’s app-level token (xapp-), for socket mode.
WhatsApp: the business phone number’s ID.
WhatsApp: a Cloud API access token.
WhatsApp: the Meta app’s secret, which signs its webhooks. Teams: the Azure app’s client secret.
Teams: the Azure Bot’s app (client) ID.
Teams: your Microsoft tenant ID; only it is answered. Required for single-tenant bots.
Webhook: an https address the agent’s replies are posted to.
Responses
Section titled “Responses”The connection; a webhook’s secret is shown only here
object
The bot’s username, the Slack workspace, or the WhatsApp number.
Telegram and WhatsApp. Opening it lets a chat talk to the agent; share it only with people who may.
Discord and Teams. Sent in a channel or chat with the bot, it lets that chat talk to the agent.
Discord. Adds the bot to a server, with the permissions to read and answer messages.
WhatsApp, Teams and webhook. Where messages are posted (Teams’ messaging endpoint); empty until the region has a public address.
WhatsApp: the webhook’s verify token.
Webhook: the bearer secret, which also signs replies. Shown only when the connection is created.
object
The chat on its platform (a Telegram chat, a Slack channel and thread, a WhatsApp number).
The person who connected it.
Example
{ "kind": "telegram", "state": "connecting"}The request is invalid
object
Example
{ "code": "not_found"}The API key is missing or invalid
object
Example
{ "code": "not_found"}No such sandbox in your organization (or no such file)
object
Example
{ "code": "not_found"}