Channels are the I/O surface the agent uses to talk to the outside world. Adapters live in channels/; MeTTa-side dispatch lives in src/channels.metta.
Each adapter exposes:
| Function | Purpose |
|---|---|
start_<name>(...) |
Called once from initChannels. Opens sockets / spawns listener threads as needed. |
getLastMessage() |
Returns the next unread inbound message as a string. Returns "" if none. |
send_message(str) |
Posts an outbound message. |
The MeTTa side reads commchannel and branches:
(= (receive)
(if (== (commchannel) irc)
(py-call (irc.getLastMessage))
(if (== (commchannel) telegram)
(py-call (telegram.getLastMessage))
(if (== (commchannel) slack)
(py-call (slack.getLastMessage))
(py-call (mattermost.getLastMessage))))))IRC adapter with simple one-time-secret authentication.
start_irc(channel, server, port, user)— connect and join.- Inbound traffic is filtered to the first user who types
auth <one-time-secret>. All other speakers are ignored. - Uses QuakeNet (
irc.quakenet.org) by default.
Mattermost adapter using a bot token.
start_mattermost(url, channel_id)— connect to a Mattermost instance.- Requires
MM_BOT_TOKENenvironment variable.
Telegram adapter using Bot API long polling.
start_telegram(chat_id, poll_timeout)— starts a poll loop.TG_CHAT_IDis optional; if empty, the adapter can auto-bind to the first valid inbound chat.- Outbound messages are chunked to Telegram-safe lengths.
Slack adapter using Slack Web API polling.
start_slack(channel_id, poll_interval)— starts a poll loop.SL_CHANNEL_IDis optional.- The bot user must already be invited to the target channel.
- If
SL_CHANNEL_IDis empty, the adapter auto-binds to the first channel where auth succeeds. - Adapter respects Slack
Retry-Afterbackoff on HTTP 429 and enforces a minimum 60s poll interval. - Uses the same one-time
auth <secret>ownership gate as the other adapters.
Not a communication channel in the send/receive sense — this is the backend for the search skill. Exposes search(query).
See tutorial-04-adding-a-channel.md.
- reference-skills-communication.md — the MeTTa surface (
send,receive,search). - reference-configuration.md — channel parameters.