Build a Messaging Chatbot
Build an AI chatbot that receives messages on Telegram, Slack, or Discord, processes them with an AI agent, and replies — all in under 5 minutes.
Use the Telegram Chatbot template for a one-click setup: Deploy Template
A workflow that: receives a message → AI Agent processes it with conversation memory → sends a reply back on the same platform.
- A Tensorify account
- A bot token for your platform (Telegram, Slack, or Discord)
- An LLM API key (OpenAI, Anthropic, etc.)
- Open @BotFather on Telegram
- Send
/newbot, follow prompts - Copy the bot token
- Go to api.slack.com/apps → Create New App
- Add Bot Token Scopes:
chat:write,app_mentions:read - Install to workspace, copy Bot Token (xoxb-...)
- Enable Event Subscriptions
- Go to discord.com/developers/applications → New Application
- Go to Bot tab, click "Add Bot"
- Copy the Bot Token
- Create a Webhook URL in your channel
Add the Trigger
Drop a Telegram Trigger (or Slack/Discord Trigger) onto the canvas. Configure your bot token in workspace Env Vars.
Add AI Agent
Connect an AI Agent node. Set:
- Provider: OpenAI (or your preference)
- Model: gpt-4o-mini (fast and cheap for chat)
- System prompt: "You are a helpful assistant on [platform]. Keep responses concise."
- Streaming: off (messaging platforms don't support SSE)
Add Conversation Memory
Drop a Window Memory node and connect it to the Agent's Memory handle. Set:
- Window size: 20 (remembers last 20 messages)
- Persistent: true
- Session key:
{{ telegram.chat_id }}(unique per chat)
Add the Reply Action
Drop a Telegram Send Message (or Slack/Discord Send) node. Configure:
- Chat ID:
{{ telegram.chat_id }} - Text:
{{ ai_agent.choices[0].message.content }} - Parse mode: Markdown
Deploy
Click Deploy → select execution mode. Set the webhook URL in your platform's bot settings.
After deploying, your workflow gets a URL like: https://triggers.tensorify.io/{teamId}/your-path
curl "https://api.telegram.org/bot{YOUR_TOKEN}/setWebhook?url=https://triggers.tensorify.io/{teamId}/{path}"
In your Slack app settings → Event Subscriptions → Request URL, paste the deployment URL.
In your Discord application → General Information → Interactions Endpoint URL.
- Personality: Customize the system prompt for tone (professional, casual, funny)
- Multi-language: Add "Respond in the user's language" to the system prompt
- Error handling: Connect the error branch to a fallback "Sorry, something went wrong" message
- Rate limiting: Keep window size reasonable (10-30) to control costs
- Add tools to the agent (Web Search, HTTP Request) for smarter responses
- Use the Playground to test before going live
- Connect multiple platforms to the same agent workflow
Telegram path (dedicated trigger — not webhook-trigger):
import TgIn from @tensorify/telegram-trigger:1.0.0
import Agent from @tensorify/ai-agent:1.0.0
import Memory from @tensorify/memory-window:1.0.0
import TgOut from @tensorify/telegram-send-message:1.0.0
node incoming @tensorify/telegram-trigger:1.0.0 {
# Bot token via workspace secret TELEGRAM_BOT_TOKEN
_secret_bindings = { TELEGRAM_BOT_TOKEN: "TELEGRAM_BOT_TOKEN" }
}
node agent @tensorify/ai-agent:1.0.0 {
provider = "openai"
model = "gpt-4o-mini"
systemPrompt = "You are a helpful chatbot. Reply briefly."
_secret_bindings = { OPENAI_API_KEY: "OPENAI_API_KEY" }
}
node memory @tensorify/memory-window:1.0.0 {
maxMessages = 12
}
node reply @tensorify/telegram-send-message:1.0.0 {
chatId = "{{ incoming.chat_id }}"
text = "{{ agent.choices[0].message.content }}"
_secret_bindings = { TELEGRAM_BOT_TOKEN: "TELEGRAM_BOT_TOKEN" }
}
incoming.payload -> agent.message
memory.memory -> agent.memory
agent.response -> reply.input
For Slack, swap to @tensorify/slack-trigger:1.0.0 + @tensorify/slack-send-message:1.0.0 and bind managed Slack OAuth (_oauth_bindings) plus SLACK_SIGNING_SECRET. Do not use webhook-trigger for Slack Events.