Chat channels
A message to your bot runs an agent turn and the reply comes back in the same chat. Channels run inside the background service, so the conversation is live in Web and the TUI too.
- Message
- Accessallowlist or group lists
Not allowed: pairing code in a direct message, no reaction in a group
- Bindingpicks the agent
No binding: [no agent configured]
- Sessionkey picks the conversation
- Turnreply in the same chat
| Platform | Arrives via | Login | Live progress | Attachments in | Files out |
|---|---|---|---|---|---|
| Telegram | Bot API long-polling | Bot token from BotFather | Yes | Photos, documents, voice, audio, video, GIFs | Photo, document |
| Discord | discord.py Gateway | Bot token | Yes | Yes | Yes |
| Slack | Socket Mode (slack_sdk) | Bot token xoxb- and app token xapp- | Yes | Yes, files:read | Yes, files:write |
| iLink long-polling | QR scan with personal WeChat | No: cannot edit sent messages | Images, voice, files, video | Image, video, file |
Releases and the complete source-development install include the Discord and Slack dependencies.
Quick start
You need an agent (openprogram agents add main) and a working model provider. The wizard picks a platform, logs in, binds an agent and starts the worker.
openprogram channels setup- Message your bot. The first reply is a pairing code.
openprogram channels access approve <channel> <code>
The conversation then appears in the session list.
Platform setup
| Platform | Before running the wizard |
|---|---|
| Telegram | @BotFather, /newbot, copy the token. No webhook or public IP. |
| Discord | Create an app and bot at the Developer Portal. On Bot, enable Message Content Intent, or the gateway rejects the connection. Invite the bot to your server. |
| Slack | Create and install an app at api.slack.com/apps. Enable Socket Mode. Bot token scopes: chat:write, app_mentions:read and the history scopes for your events, such as im:history. App token under Basic Information → App-Level Tokens with connections:write. Subscribe to message and app_mention, the two the adapter handles. Both tokens are required. |
Personal WeChat, no Official Account. In Settings → Channels → Add bot, pick WeChat and Get QR code, or run the login command; scan with WeChat and confirm. An expired code is replaced with Get new code. The scanner is let in with no pairing code. Credentials persist until bot token invalid — relogin required. Uses Tencent's iLink backend; its terms are personal-use only. |
Commands
Each --id is one bot login with its own credentials and bindings.
openprogram channels list # status of every account
openprogram channels accounts add telegram --id work # create an account slot
openprogram channels accounts login telegram --id work # enter credentials (QR for wechat)
openprogram channels accounts rm telegram work # delete account + its bindings
openprogram channels bindings add main --channel telegram # catch-all → agent "main"
openprogram channels bindings add main --channel telegram \
--account work --peer 123456 --peer-kind direct # one peer only
openprogram channels bindings list
openprogram channels bindings rm <binding_id>
| TUI command | Effect |
|---|---|
/login <channel> | Enroll and wire to the current agent |
/attach <channel> <peer> | Route one peer into the current session |
/detach, /connections | Undo, list |
Who can talk to your bot
Direct messages use pairing. An unlisted sender's message is dropped before any agent and the sender receives an eight-character code. Approval exists only as a local CLI or API call, so nothing typed in chat can approve anyone. There is no setting that turns the gate off.
openprogram channels access list # policy + allowlist + pending codes
openprogram channels access approve telegram K7XQ2MVR # approve by pairing code
openprogram channels access allow telegram 123456789 # allowlist a user id directly
openprogram channels access revoke telegram 123456789 # remove a sender
- Codes expire after one hour; a blocked sender gets the same code again, at most once a minute.
access allowadds a known platform ID without a code.- Everyone on the allowlist reaches the same agent and acts as you, and memory is one workspace for the instance. Keep it to people you would hand this machine to.
What approved senders may do
A direct-message turn has the same tools as the Web UI under that chat session's mode and rules, so in default Bypass permissions it can run commands here without a prompt. Approvals arrive as chat questions, answered with /answer.
openprogram channels accounts set wechat sender_access paired # or: owner, the default (all channels)
paired limits everyone on the account to replies and memory, in direct messages and groups. For separate memory, someone runs their own instance:
openprogram --profile alice
Group chats
Telegram, Discord and Slack. WeChat bots receive direct messages only.
| Sender | Replies | Memory | Every tool, as you |
|---|---|---|---|
Bound contact, or full access | Yes | Yes | Yes |
chat access | Yes | Yes | No |
| Anyone else | No reaction | No | No |
Anyone else gets no reply, pairing code or error, and no conversation is created. A new group lists nobody.
openprogram channels accounts group-users add telegram 123456789 --access chat # replies and memory only
openprogram channels accounts group-users add discord 80351110224678912 --access full # runs as you
openprogram channels accounts group-users remove telegram 123456789
openprogram channels accounts group-users list telegram
openprogram channels accounts group-users add telegram 123456789 --access full --group -1001234567890
openprogram channels accounts group-users remove telegram 123456789 --group -1001234567890 # the group keeps its lists, even when empty
openprogram channels accounts group-users reset telegram --group -1001234567890 # use the account's lists again
- First block: account-wide lists. Second: one group's lists, which replace the account's for that group;
removekeeps the group's lists even when empty, andresetreturns to the account's. Bound contacts keep full access. A Discord thread uses its parent's lists unless it has its own. - IDs are stable platform user IDs: numeric on Telegram and Discord (Developer Mode, Copy User ID),
U…on Slack. The worker log names every ignored sender. Changes apply to the next message. - Settings > Channels holds the account-level lists; per-group lists are command-line only.
require_mentionstill applies: an unmentioned message from a listed person waits as context.chatusers cannot use/new,/reset,/activation,/memory,/stopor/help. What they write is context for later turns that run as you.access revokeonly touches the allowlist; usegroup-users removefor these lists. A bound contact cannot bechat: revoke first, which also ends their direct messages. Binding someone listed aschattakes them off the lists.- Nothing a sender types can change these lists.
Upgrading from a version with group_access
That setting is gone and a stored value is ignored. Teammates approved by pairing code from a group had replies and memory only; on the allowlist they now run as you in groups. Before upgrading, run openprogram channels access list, then for each teammate access revoke and group-users add <channel> <user id> --access chat.
Channels and environments
A channel decides where messages are mirrored; the conversation's project decides where tools run, on its machine. A conversation arriving from a channel is in the home project, on this computer; a bound conversation keeps its own project.
| Topic | Behaviour |
|---|---|
| Channel chip | Above the message box in Web and App, beside the machine chip: logo and account, or No channel. Dot: yellow degraded, red unreachable. Opens one row per app; pick an account to bind or switch, Disconnect to stop, Manage channels to add. |
| Bound WeChat account | Your WeChat's messages to the bot arrive here instead of a separate conversation. One conversation holds each person's chat on an account; picking the same person elsewhere moves it, and conversations with other people on that account stay. A pick with no known person takes the whole account. Disconnecting or switching returns messages to their usual conversation. |
| Replies in a bound conversation | Every assistant reply goes out, whatever started the turn: typing in the App, a Goal turn or a reminder. Only the reply: your typed message, tool progress and thinking stay in the App. An always-on check-in or a scheduled task sends its report instead, unless the Agent's Channels setting is off. |
| Approval pause | Sends what was written before; after approval, only what follows |
| No recipient | A Telegram, Discord or Slack account picked without a specific chat keeps replies in the App |
| Delivery failure | The App shows a notice with channel and error kind; the reply stays saved |
| Account status | Settings, Channels, one line per bot: Running, Turned off, Not signed in, Signed out (the token or login stopped working), Stopped by an error, Reconnecting, Not responding or Not started yet. A bad state says what to do, and the bot starts by itself after you sign in again. |
Chats and sessions
| Platform | One session per |
|---|---|
| Telegram | Chat; group behaviour is per account (below) |
| Discord, Slack | (channel, user): two senders in one channel get separate conversations and cannot see or answer each other's questions. Memory stays one workspace. |
| Peer |
| Setting | Effect |
|---|---|
session_scope | Default per-account-channel-peer. Also per-channel-peer, per-peer, or main; each agent keeps its own sessions, so two agents on main never share one |
session_daily_reset: "HH:MM", session_idle_minutes | Rotate daily or after idle time |
/new, /reset | Fresh conversation now; the previous stays in the sidebar |
| Deleting in the Web UI | Same: the next message starts a new one |
Who said it
Every channel message carries its sender, direct messages included (main puts peers together). Web, CLI and TUI turns have none.
{"speaker_kind":"human","speaker_id":"7391","speaker_display":"Ada","content":"the budget is 50k"}
{"speaker_kind":"human","speaker_id":"8022","speaker_display":"Bo","content":"make it 80k"}
- The ID stays when someone renames and separates people with the same name; memory records each fact under who said it.
- A display name is put on one line, capped at 64 characters, square brackets made round. Message text is kept exactly; typing a name in brackets does not impersonate.
- The web transcript shows a small line above the bubble, such as
WeChat · Ada; a WeChat sender has no nickname, so the ID is shortened to its first and last four characters.
Group behaviour
| Mode | Behaviour |
|---|---|
always | Every message starts a turn |
mention | Only an @mention or reply to the bot; the mention is stripped. The next turn gets the latest 50 other messages with senders, behind an "earlier messages in the chat" toggle in the web transcript. |
ambient | Every message starts a turn and the agent decides whether to speak with chat_send. Replies to unaddressed messages stay in the web transcript as "overheard". No typing or ack reaction. Addressed messages are answered normally. Costs a model call per message. |
openprogram channels accounts set telegram require_mention on # or: off (also discord, slack)
openprogram channels accounts set telegram group_sessions per-user # or: shared (telegram only)
require_mentionsets the default:onismention,off(default) isalways.- Someone with full access uses
/activation mention|always|ambient; alone it shows the mode. Direct messages are never gated. group_sessions(Telegram; restart the worker):shared(default) orper-user.- Group members reach the agent's memory.
/memory readstops writes,/memory offremoves it,/memory on(default) follows the agent's setting. Direct messages always follow the agent. - Other bots' messages are ignored and duplicate deliveries start one turn. At most 10 turns a minute per group; the rest wait as earlier messages.
Chat commands
| Command | Effect |
|---|---|
/new, /reset | Fresh conversation |
/stop | Stop the work running in this conversation at once. Where each person in a group has their own (Discord, Slack, Telegram per-user), only yours. Messages already waiting still run |
/help | List these commands |
/activation [mention|always|ambient] | Show or switch the group's mode |
/memory [on|read|off] | Show or narrow the group's memory access |
/answer <question_id> <choice> | Answer a function's question (runtime.ask) or tool approval; free text allowed |
/decline <question_id> | Decline it |
Work in a group without a mention; /new@yourbot works on Telegram. Only that chat's session questions can be answered; in a group, only by the person whose message started the turn.
Replies and progress
| Telegram | Discord | Slack | ||
|---|---|---|---|---|
| Typing shown | Yes | Yes | No | Yes |
| Progress | ⏳ working... edited live (⚙ bash → ✓ bash), then replaced by the reply | Same | Same | Paragraph by paragraph, about 200 characters each; text before a tool goes first |
| Format | HTML | Markdown | mrkdwn | Plain text |
| Split at | 4,000 | 1,800 | 39,000 | 1,800 |
Delivery details
- A long reply fills the placeholder then continues in new messages. A placeholder that cannot be edited falls back to a new message.
- Slack threads and Telegram forum topics keep placeholder, reply, files and the agent's own notes and questions in place; a Telegram topic also shows typing there. A Slack thread reply also sent to the channel counts as a message.
- Editing a Telegram message sent before the service started does nothing.
ack_reaction on(not WeChat) adds 👀 on pickup; Slack needsreactions:write.- A long code block stays closed in each message and reopens in the next. Discord replies never ping anyone,
@everyoneincluded. A photo Telegram refuses is sent as a file instead. - Rate-limited sends retry with
Retry-Afterwhen given, up to three attempts, then log a structured error. A connection that could not be opened is retried up to four attempts; nothing reached the platform, so nothing arrives twice. - Crashed connection loops reconnect with backoff, 5 s doubling to 5 min. Invalid credentials stay down until you log in again; a Telegram token the API rejects counts. WeChat server errors wait and retry, 3 s doubling to 48 s.
- The service checks accounts every few seconds: linking, logging in, enabling or disabling needs no restart.
A conversation runs one turn at a time, App turns included. While another turn runs or waits for an answer:
| Arrives | What happens |
|---|---|
| A chat message | Waits up to 30 seconds, then the bot says it is busy. Send it again later. |
An unaddressed group message, ambient mode | No reply; it joins the group's next turn. |
| Typing in the App | Refused, as during any other turn. |
/new, /reset | Wait up to 30 seconds for a chat app turn, then the bot says it is busy. |
Messages from one chat start turns in the order they arrived, even when an earlier one has a slow attachment. Commands do not queue.
Attachments
| Direction | Behaviour |
|---|---|
| Incoming | Saved to <state>/channels/<channel>/accounts/<account>/attachments/, 20 MB per file, listed as [attachment: <path> (<type>, <size>)]. Images up to 4 MB also reach the model. A file that could not be fetched leaves a line saying so. |
| Telegram voice | Turned into text with the engine in Settings → Voice and added to the message, caption kept. Needs ffmpeg; if transcription fails, the turn says why and the audio file is still attached. |
| WeChat media | Encrypted from Tencent's CDN, decrypted on download. Voice arrives as WeChat's transcription when present, otherwise a .silk file the model cannot hear. |
| Replies to messages | Quoted text appears above as a > quoted block (Telegram, Discord reply; Slack thread) |
| Outgoing | Telegram: photos or documents. Discord: upload with the caption. Slack: external upload, files:write. WeChat: encrypted, uploaded, sent by type, 100 MB, caption as a separate message. Only files the agent handed over with send_file upload; a marker it writes in its reply sends nothing and becomes a short note. |
from openprogram.interfaces.channels.outbound import send_file
send_file("telegram", "default", "123456", "/path/to/report.pdf", caption="Weekly report")
Errors
| What happened | What to do |
|---|---|
| Pairing code instead of an answer | access approve <channel> <code> or access allow <channel> <user-id> |
[no agent configured] | openprogram agents add main, then channels setup or channels bindings add |
account … has no bot_token | openprogram channels accounts login <channel> --id <account> |
Slack account … needs both bot_token (xoxb-...) and app_token (xapp-...) | Log in again and paste both |
Discord channel requires discord.py, Slack channel requires slack_sdk | Incomplete runtime: reinstall the release, or rerun the complete source-development installer |
| Discord connects but sees nothing | Enable Message Content Intent |
bot token invalid — relogin required | openprogram channels accounts login wechat --id <account> and rescan |
adapter crashed … reconnecting in Ns | Reconnects itself. Only adapter exited on its own needs action, usually a login. |
| "The reply was not delivered to WeChat (…)" | auth: log in again. network, rate_limit: unreachable or throttled after retries. channels_unavailable: the process running the turn has no channels loaded. The reply is saved. |
auth, rate_limit, bad_target in the log | Token revoked or expired, rate limit (already retried), or wrong chat or channel ID |
Channel design · Interfaces · Always-on Agents