Gateway
Connect Arcana to Telegram, Discord, Slack, and WhatsApp. Each platform runs as a separate adapter — you can enable one or all simultaneously.
Overview
The gateway lets Arcana act as an AI assistant inside your existing chat platforms. Each chat ID gets its own agent session with conversation history and memory integration — the bot remembers context within each chat.
arcana gateway
You can also pass tokens directly:
arcana gateway --telegram-token "111:xxx"
arcana gateway --discord-token "xxx"
The gateway requires a Pro or Enterprise license. Set ARCANA_LICENSE_KEY or complete arcana console login before starting.
Configuration
Add a gateway block to ~/.arcana/config.json:
{
"provider": "openai",
"model": "gpt-4o",
"gateway": {
"telegram": { "token": "111:xxx", "allowedUsers": ["12345678"] },
"discord": { "token": "xxx", "allowedChannels": ["987654321"] },
"slack": { "botToken": "xoxb-xxx", "signingSecret": "xxx", "allowedChannels": ["C0123ABC"] },
"whatsapp": { "phoneNumberId": "123456", "accessToken": "xxx", "appSecret": "xxx", "allowedUsers": ["14155551234"] }
}
}
See Configuration for the full reference.
Telegram
- Message @BotFather on Telegram and create a new bot.
- Copy the bot token into your config.
- Add your Telegram user ID to
allowedUsers.
To find your numeric user ID, forward a message from your bot to @userinfobot, or call https://api.telegram.org/bot<TOKEN>/getUpdates and look for from.id.
The Telegram adapter uses polling mode (no public URL needed) and formats responses with Markdown.
Discord
- Create a new application at discord.com/developers.
- Go to Bot → copy the bot token.
- Enable Message Content Intent under Privileged Gateway Intents.
- Invite the bot to your server with the
botscope andSend Messages+Read Message Historypermissions. - Add the channel ID to
allowedChannels.
Discord replies are capped at 2000 characters. Longer responses are truncated automatically.
Slack
- Create a new app at api.slack.com/apps.
- Under OAuth & Permissions, add the
chat:write,channels:history, andim:historyscopes. - Install the app to your workspace and copy the Bot User OAuth Token (
xoxb-...). - Under Basic Information, copy the Signing Secret.
- Under Event Subscriptions, enable events and request the
message.channelsandmessage.imbot events. - Add the channel ID to
allowedChannels.
Check Slack's API docs for the latest required scopes, as they may change.
WhatsApp uses the Meta Cloud API via webhooks. You need a Meta Business App with the WhatsApp product added.
- Create a Meta Business App at developers.facebook.com.
- Add the WhatsApp product to your app.
- Copy the Phone Number ID and Access Token into your config.
- Set
appSecretfor webhook signature verification (required for production). - Expose your local webhook server (port 3100 by default) with a tool like
ngrok:ngrok http 3100 - In the Meta dashboard, configure the webhook URL as
https://your-domain/webhookand subscribe tomessagesevents. - Set
verifyTokento match what you configure in the Meta dashboard (or it defaults to a random UUID).
WhatsApp messages are capped at 4096 characters. Longer responses are truncated automatically.
Security
Allowlists (required)
Every platform requires an allowlist. The gateway refuses to start with an empty or missing allowlist unless ARCANA_GATEWAY_OPEN=1 is set (local dev only).
| Platform | Allowlist field | What to put |
|---|---|---|
| Telegram | allowedUsers | Telegram user IDs (numeric) |
| Discord | allowedChannels | Discord channel IDs |
| Slack | allowedChannels | Slack channel IDs (C0...) |
allowedUsers | Phone numbers with country code, no + |
WhatsApp webhook signatures
The WhatsApp adapter verifies x-hub-signature-256 on every incoming webhook request using your appSecret. This is required in production. Set ARCANA_WHATSAPP_INSECURE=1 only for local development.
Dev escape hatches
| Env / CLI | Effect |
|---|---|
ARCANA_GATEWAY_OPEN=1 | Allow empty platform allowlists (local dev only). |
ARCANA_WHATSAPP_INSECURE=1 | Skip WhatsApp webhook signature verification (dev only). |
WHATSAPP_WEBHOOK_PORT | Override the WhatsApp webhook listen port (default: 3100). |
How it works
- Each chat platform adapter translates messages to and from Arcana.
- Every chat ID gets its own agent session with conversation history and memory integration.
- Destructive shell commands are blocked by default for safety.
- The agent has a capped tool-call budget per turn to prevent runaway executions.
- Provider keys and model selection come from your main
~/.arcana/config.json.