# Channels Channels let you talk to Morphy from a messaging platform — **Telegram, Discord, Slack, or X (Twitter)**. Morphy receives messages, does the work, and replies in the same chat. Each channel uses a small adapter program (`channel-telegram`, `channel-discord`, `channel-slack`, `channel-x`). Install the one you need: ```bash npm install -g @morphy-agent/channel-telegram # or channel-discord / channel-slack / channel-x # or pip install morphy-agent-channel-telegram ``` Then add and enable it from the Morphy interface. The general shape is: ``` /channels add /channels set-env /channels enable ``` Use `/channels list` to see configured channels and `/channels disable ` to turn one off. > Tip: use `/channels set-env-secret …` instead of `set-env` to store tokens in the encrypted > [vault](configuration.md#secrets-vault) rather than in plain config. --- ## Telegram 1. Create a bot with [@BotFather](https://t.me/BotFather) and copy the bot token. 2. In Morphy: ``` /channels add telegram channel-telegram /channels set-env telegram TELEGRAM_BOT_TOKEN 1234567890:AAF_your_token /channels enable telegram ``` 3. Message your bot — Morphy replies. ## Discord 1. Create an application at [discord.com/developers](https://discord.com/developers/applications). 2. Under **Bot**, enable **Message Content Intent** and copy the token. 3. In Morphy: ``` /channels add discord channel-discord /channels set-env discord DISCORD_BOT_TOKEN your_token_here /channels enable discord ``` 4. Invite the bot to your server with the **bot** scope and **Send Messages** permission. ## Slack 1. Create an app at [api.slack.com/apps](https://api.slack.com/apps). 2. Under **OAuth & Permissions**, add `chat:write`, `im:history`, `im:read`, and install to the workspace (this gives a Bot Token starting `xoxb-`). 3. **Recommended — Socket Mode (push):** enable **Socket Mode**, create an app-level token with `connections:write` (starts `xapp-`), and subscribe to the `message.im` event. Without it the adapter falls back to polling, which Slack now rate-limits for new non-Marketplace apps. 4. In Morphy: ``` /channels add slack channel-slack /channels set-env-secret slack SLACK_BOT_TOKEN xoxb-your-token /channels set-env-secret slack SLACK_APP_TOKEN xapp-your-token /channels enable slack ``` ## X (Twitter) DMs require a **paid tier** (Basic or higher / pay-per-use) and **OAuth 2.0 user-context** auth — app-only bearer tokens are rejected for DM endpoints. 1. Get API access at [developer.x.com](https://developer.x.com) and create a project/app on a paid tier. 2. Enable OAuth 2.0 (Authorization Code + PKCE) with scopes `dm.read dm.write users.read offline.access`, then run the user-authorization flow to obtain an **access token** and a **refresh token**. 3. In Morphy: ``` /channels add x channel-x /channels set-env-secret x X_BEARER_TOKEN /channels set-env x X_CLIENT_ID /channels set-env-secret x X_REFRESH_TOKEN /channels enable x ``` With `X_CLIENT_ID` + `X_REFRESH_TOKEN` set, the adapter rotates the access token automatically on expiry. --- ## Commands inside a chat Once connected, you (and approved users) can control Morphy from the messaging platform with `/` commands. The defaults: | Command | What it does | | --- | --- | | `/help` | List available commands | | `/status` | Show the current session | | `/model ` | Switch model | | `/provider ` | Switch provider | | `/mode ` | Change permission mode | | `/sessions` | List sessions | | `/usage` | Show whether a run is currently active | Who is allowed to run these is controlled per channel — manage it with the `/channels` commands or in your settings file.