Skip to content

Chat apps and webhooks

A sandbox’s agent can answer messages from Telegram, Slack, Discord, Microsoft Teams, WhatsApp, or your own systems through a webhook. Stillbox keeps the connection open for you. When a message arrives, the sandbox wakes, the agent answers and the reply goes back to the chat. In between, the sandbox sleeps, so a bot that is always reachable costs what its replies take.

Each chat is its own conversation with the agent: a Telegram chat, a WhatsApp number, a Slack thread or direct message, a Discord channel or direct message, a Teams chat or channel thread, or a webhook’s chat. Messages in one chat are answered in order.

Add a connection from the sandbox’s Chat apps tab. Tokens are checked, then kept sealed in your region; they never enter the sandbox.

  1. In Telegram, ask @BotFather for a new bot (/newbot) and copy its token.
  2. Add a Telegram connection with the token.
  3. Open the connection’s link from each chat that should reach the agent, or add the bot to a group and open it there. Anyone else who messages the bot is told it’s private.

The link lets a chat talk to the agent, so share it only with people who may. You can remove a chat from the connection at any time. Stillbox takes over the bot’s messages: a webhook set on the bot elsewhere is removed.

  1. Create a Slack app for your sandbox. Turn on Socket Mode.
  2. Subscribe to the bot events app_mention and message.im, give the bot chat:write, and install the app.
  3. Create an app-level token with connections:write.
  4. Add a Slack connection with the bot token (xoxb-…) and the app-level token (xapp-…).

Mention the bot in a channel it was invited to, and it answers in a thread; each thread is a conversation. Direct messages work too.

  1. In Discord’s developer portal, create an application and add a bot. Under Bot → Privileged Gateway Intents, turn on Message Content, and copy the bot’s token.
  2. Add a Discord connection with the token. Stillbox keeps the bot’s connection to Discord open, so it needs no public address.
  3. Open the connection’s invite link to add the bot to your server.
  4. In each channel that should reach the agent, send @yourbot connect <code> (the connection shows the whole command). For direct messages, send connect <code> to the bot.

In a server the bot answers when it is mentioned, replying to the message; in a direct message it answers everything. Anyone else who mentions it is told it’s private. Its replies never ping anyone. Messages sent while Stillbox reconnects to Discord (rare, and brief) aren’t seen.

  1. In the Azure portal, create an Azure Bot (single tenant) and add the Microsoft Teams channel. Create a client secret for its app.
  2. Add a Teams connection with the bot’s app ID, the client secret and your tenant ID. Stillbox checks them with Microsoft’s sign-in.
  3. Set the bot’s messaging endpoint to the address the connection shows.
  4. Install the bot in Teams. In a one-to-one chat, send the connection’s code; in a channel or group chat, mention the bot and send connect <code>.

Stillbox answers only requests signed by Microsoft’s Bot Framework for your bot, and only from your tenant. Teams needs your region’s public address, which your Stillbox administrator sets up with the domain.

  1. Set up the WhatsApp Cloud API in a Meta app with your business number.
  2. Add a WhatsApp connection with the number’s phone number ID, an access token and the app secret.
  3. In the Meta app, set the webhook’s callback address and verify token to the ones the connection shows, and subscribe to messages.
  4. Open the connection’s link from each phone that should reach the agent.

WhatsApp needs your region’s public address, which your Stillbox administrator sets up with the domain.

A webhook connection gives you an address and a secret (shown once). Post messages from your own systems:

Terminal window
curl -X POST "$HOOK_URL" -H "Authorization: Bearer $SECRET" -H "Content-Type: application/json" \
-d '{"text": "New order 1001 from Sara: two lamps", "chat": "orders"}'

The answer is 202 with the message’s ID. Send an Idempotency-Key header so a message sent twice is answered once. If you gave a reply address, the agent’s reply is posted there as JSON: connection_id, message_id, chat, status and text. It is signed like Stillbox’s webhooks, with the connection’s secret.

Messages are kept until a day after they’re answered, in your region, and the connection’s Recent messages show them. The agent’s replies stay in the sandbox’s conversations. Images and voice messages are ignored for now.