Skip to content

Connect the sandbox's agent to Telegram, Slack, WhatsApp or a webhook

POST
/sandboxes/{id}/connections
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_token from @BotFather. Chats join by opening pair_link.
  • slack: bot_token (xoxb-) and an app-level app_token (xapp-) with socket mode on. The bot answers direct messages and mentions, in threads.
  • whatsapp: phone_number_id, access_token and app_secret from Meta. Set webhook_url and verify_token as the app’s webhook, subscribed to messages. Chats join by opening pair_link.
  • webhook: POST messages to webhook_url with secret as a bearer token (shown once). Replies go to reply_url, if set, signed like Stillbox’s webhooks.
id
required
string
Media typeapplication/json
object
kind
required
string
Allowed values: telegram slack discord teams whatsapp webhook
name

Defaults to the bot’s name, the Slack workspace or the number.

string
<= 100 characters
bot_token

Telegram’s bot token, Slack’s bot token (xoxb-), or Discord’s bot token.

string
app_token

Slack’s app-level token (xapp-), for socket mode.

string
phone_number_id

WhatsApp: the business phone number’s ID.

string
access_token

WhatsApp: a Cloud API access token.

string
app_secret

WhatsApp: the Meta app’s secret, which signs its webhooks. Teams: the Azure app’s client secret.

string
app_id

Teams: the Azure Bot’s app (client) ID.

string
tenant_id

Teams: your Microsoft tenant ID; only it is answered. Required for single-tenant bots.

string
reply_url

Webhook: an https address the agent’s replies are posted to.

string

The connection; a webhook’s secret is shown only here

Media typeapplication/json
object
id
required
string
sandbox_id
required
string
kind
required
string
Allowed values: telegram slack discord teams whatsapp webhook
name
required
string
enabled
required
boolean
state
required
string
Allowed values: connecting connected error
error
string
address
required

The bot’s username, the Slack workspace, or the WhatsApp number.

string
pair_link

Telegram and WhatsApp. Opening it lets a chat talk to the agent; share it only with people who may.

string
pair_command

Discord and Teams. Sent in a channel or chat with the bot, it lets that chat talk to the agent.

string
invite_link

Discord. Adds the bot to a server, with the permissions to read and answer messages.

string
webhook_url

WhatsApp, Teams and webhook. Where messages are posted (Teams’ messaging endpoint); empty until the region has a public address.

string
verify_token

WhatsApp: the webhook’s verify token.

string
reply_url
string
secret

Webhook: the bearer secret, which also signs replies. Shown only when the connection is created.

string
chats
required
Array<object>
object
id
required

The chat on its platform (a Telegram chat, a Slack channel and thread, a WhatsApp number).

string
name
required
string
created_at
required
string format: date-time
last_message_at
string format: date-time
created_at
required
string format: date-time
by

The person who connected it.

string

Example

{
"kind": "telegram",
"state": "connecting"
}

The request is invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

The API key is missing or invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

No such sandbox in your organization (or no such file)

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}