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

What You'll Build

A workflow that: receives a message → AI Agent processes it with conversation memory → sends a reply back on the same platform.

Prerequisites

  • A Tensorify account
  • A bot token for your platform (Telegram, Slack, or Discord)
  • An LLM API key (OpenAI, Anthropic, etc.)

Step 1: Create Your Bot

Telegram

  1. Open @BotFather on Telegram
  2. Send /newbot, follow prompts
  3. Copy the bot token

Slack

  1. Go to api.slack.com/apps → Create New App
  2. Add Bot Token Scopes: chat:write, app_mentions:read
  3. Install to workspace, copy Bot Token (xoxb-...)
  4. Enable Event Subscriptions

Discord

  1. Go to discord.com/developers/applications → New Application
  2. Go to Bot tab, click "Add Bot"
  3. Copy the Bot Token
  4. Create a Webhook URL in your channel

Step 2: Build the Workflow

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.

Setting the Webhook URL

After deploying, your workflow gets a URL like: https://triggers.tensorify.io/{teamId}/your-path

Telegram

curl "https://api.telegram.org/bot{YOUR_TOKEN}/setWebhook?url=https://triggers.tensorify.io/{teamId}/{path}"

Slack

In your Slack app settings → Event Subscriptions → Request URL, paste the deployment URL.

Discord

In your Discord application → General Information → Interactions Endpoint URL.

Tips

  • 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

Next Steps

  • 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
On this page