Use Case: Messaging Bot
Telegram ยท Discord ยท Slack โ one config entry, live in minutes
What you'll build
An OpenClaw agent that lives inside your chat app. Send it a message, it responds. Give it tools (search, GitHub, browser) and it becomes a capable assistant your whole team can use.
Jump to section
Telegram setup
Telegram is the easiest channel to set up and the most popular for personal/team bots. The whole process takes about 3 minutes.
Step 1 โ Create a bot with BotFather
- Open Telegram and search for
@BotFather - Send
/newbotand follow the prompts - Copy the bot token โ it looks like
1234567890:AAF...
Step 2 โ Get your chat ID
# Send any message to your bot, then run:
curl https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
# Look for "chat":{"id": YOUR_CHAT_ID}Step 3 โ Add to openclaw.json
{
"model": "claude-sonnet-4-5",
"soulPath": "./SOUL.md",
"channel": {
"type": "telegram",
"token": "YOUR_BOT_TOKEN",
"chatId": "YOUR_CHAT_ID"
}
}Group chats: Add the bot to a Telegram group and set the chatId to the group's ID (negative number, e.g. -1001234567890). The agent responds to all messages in the group by default โ add a trigger prefix like @botname in the SOUL.md to avoid spam.
For a detailed Telegram production setup including webhook mode, rate limiting, and auth, see the Telegram Production Setup guide.
Discord setup
Discord requires creating a bot application in the Discord Developer Portal.
- Go to discord.com/developers/applications โ New Application
- Under Bot, click Add Bot and copy the token
- Under OAuth2 โ URL Generator, enable scopes:
bot+ permissions:Send Messages, Read Message History - Invite the bot to your server using the generated URL
- Get the channel ID: right-click any channel โ Copy Channel ID (enable Developer Mode in Settings first)
{
"model": "claude-sonnet-4-5",
"soulPath": "./SOUL.md",
"channel": {
"type": "discord",
"token": "YOUR_BOT_TOKEN",
"channelId": "YOUR_CHANNEL_ID"
}
}Slack setup
Slack requires a Slack App with Socket Mode enabled.
- Go to api.slack.com/apps โ Create New App โ From scratch
- Under Socket Mode, enable it and generate an App-Level Token with
connections:writescope - Under OAuth & Permissions, add bot scopes:
chat:write,im:history,channels:history - Install the app to your workspace and copy the Bot User OAuth Token
{
"model": "claude-sonnet-4-5",
"soulPath": "./SOUL.md",
"channel": {
"type": "slack",
"botToken": "xoxb-your-bot-token",
"appToken": "xapp-your-app-token"
}
}SOUL.md template
This template works for all three channels. Adjust the name, tone, and capabilities to fit your use case.
# Team Assistant Bot You are a helpful assistant living in the team's chat. You answer questions, run tasks, and help the team work faster. ## Identity - Name: Assistant - Tone: Friendly, concise, professional ## Capabilities - Answer questions about the codebase, docs, or general topics - Run web searches and summarise results - Check GitHub for PR status, issues, and recent commits - Post formatted summaries โ use markdown when helpful ## Behaviour - Keep responses short by default โ no more than 3โ4 sentences unless asked for detail - If a task will take more than 30 seconds, confirm before starting: "This might take a minute โ should I proceed?" - When someone asks a yes/no question, answer yes or no first, then explain ## Trigger - Respond to all direct messages - In group channels, respond only when the message starts with @assistant or /ask
Slash commands and scheduled messages
Add cron jobs to send proactive messages to your channel on a schedule:
{
"crons": [
{
"name": "Daily standup prompt",
"schedule": "0 9 * * 1-5",
"task": "Post a standup prompt to the team channel: ask everyone to share what they did yesterday, today, and any blockers."
},
{
"name": "Weekly repo summary",
"schedule": "0 10 * * 1",
"task": "Check GitHub for PRs merged last week and post a summary to the team channel."
}
]
}Common issues
โ Telegram bot not receiving messages
Make sure you sent at least one message to the bot before starting OpenClaw. The bot token only starts polling after the first interaction. Also verify the chatId matches the actual chat.
โ Discord bot shows as offline
Check that the bot has the correct intents enabled: MESSAGE_CONTENT intent is required for reading messages. Enable it in the Developer Portal under Bot โ Privileged Gateway Intents.
โ Slack bot gives "not_in_channel" error
Invite the bot to the channel first: /invite @your-bot-name in Slack. The bot must be a member of the channel to post there.
โ Bot responds to every message in a group (too noisy)
Add a trigger condition to your SOUL.md: "Respond only when the message starts with @botname or /ask". The agent will filter incoming messages accordingly.
Related guides
Did this guide solve your problem?