Docs
Telegram Bot Integration

Telegram Bot Integration

Connect your Telegram bot to an n8n workflow through DashLynk, track every conversation, and reply with text or rich media.

DashLynk lets you connect a Telegram bot to any n8n workflow so that every conversation is tracked, logged, and shown in a clean chat-style view inside your dashboard. No more digging through n8n execution logs to find out what a user asked or how your bot responded. You can scroll through the full message history for any user, see exactly what the bot replied, and review performance without leaving DashLynk. Setup takes only a few minutes.

How It Works

DashLynk sits between your Telegram bot and your n8n workflow. When a user sends a message to your bot, DashLynk routes it to your workflow and delivers the reply back to the user. Every exchange is logged and stored automatically.

All your data and the bot token is stored securely and never exposed, and only your account has access to the conversations.

Before You Start

  • A Telegram account
  • Access to @BotFather on Telegram
  • An n8n instance (cloud or self-hosted)
  • A DashLynk account

Step 1: Create a Bot on Telegram

  1. Open Telegram and start a chat with @BotFather
  2. Send the /newbot command and follow the prompts
  3. Choose a display name, then a username (the username must end in bot)
  4. BotFather will give you a bot token. Copy it and keep it somewhere safe.

Keep your bot token private. Never share it publicly or commit it to source control.

Step 2: Add the Bot to DashLynk

  1. Go to Dashboard > Bots and click New Bot
  2. Select Telegram Bot as the channel type
  3. Paste the token you copied from BotFather and click Verify
  • DashLynk instantly checks the token with Telegram and pre-fills the bot name for you.
  1. Click Create Bot

Your token is stored securely and is never visible in the dashboard or shared with anyone.

Step 3: Connect Your n8n Workflow

  1. On the bot's config page, find n8n Webhook Connection and click Connect Your n8n Webhook
  2. In your n8n workflow, make sure you have two key nodes in place:
    • A Webhook trigger node at the start of your workflow. This is the entry point where DashLynk delivers each incoming Telegram update as JSON. Copy the webhook URL from this node.
    • A Respond to Webhook node at the end of your workflow. This is where you send the reply back to DashLynk in the expected format. Everything in between is your own logic: your AI agent, business rules, data lookups, or anything else your workflow needs to do.
  3. Paste the webhook URL from your n8n Webhook node into the DashLynk modal and click Save

DashLynk registers your bot with Telegram automatically. Your bot is now live and ready to receive messages.

Use the Webhook trigger node in n8n, not the Telegram Trigger node. DashLynk forwards each update as Telegram’s standard update JSON in the webhook payload. That input is the same kind of structure you would see after a Telegram Trigger node (message, callback_query, from, chat ids, and so on), so you can build and debug expressions the same way — only the entry node changes. In practice you usually read those fields from the Webhook item (for example $json.body.message when the body wraps the update; the exact path can vary slightly by n8n Webhook options).

The response format follows the same structure used by all DashLynk bots. See Backend Integration for a full reference.

Sending Replies from Your n8n Workflow

Your Respond to Webhook node tells DashLynk what to send back to the user. It must return a JSON object with an output field containing the reply text.

{
  "output": "Hello! How can I help you today?"
}

When your reply contains dynamic content generated by an AI node or other workflow step, use JSON.stringify to safely handle special characters and quotes:

{
  "output": {{ JSON.stringify($json.output) }}
}

Sending Media Attachments

Your n8n Respond to Webhook node returns JSON with output (caption or reply text) and, when needed, an attachments array. DashLynk turns that response into what your users actually receive in Telegram: photos, videos, voice messages, audio files, documents, and plain text. Use the same attachments format as chat widgets. DashLynk also records each exchange so you can review it later in Dashboard > Conversations. The important part is shaping the webhook response for the Telegram user.

What you can send

Every item uses the same object shape: type, data, and mimeType. Choose mimeType (and a matching file) so DashLynk can deliver the right kind of Telegram message (photo, voice, document, etc.).

KindTypical mimeType valuesNotes
Imageimage/jpeg, image/png, image/webp, image/gifSent to the user as a photo in the chat (with output as caption when present).
Videovideo/mp4, video/webm, video/quicktime, video/mpegSent as video; prefer reachable URLs for large files.
Document / fileapplication/pdf, Word, Excel, text/plain, …Sent as a document (downloadable file in Telegram).
Audio (playback)audio/mp3, audio/mpeg, audio/wav, audio/webmSent as audio the user can play in Telegram (e.g. longer clips or music-style replies).
Voice noteaudio/ogg (OGG Opus, Telegram’s usual voice format)Same attachments shape as other audio. With OGG Opus, DashLynk can deliver a round voice message in Telegram (short spoken replies). Other audio MIME types are still delivered as audio to the user but may not appear as a native “voice message” bubble.

Attachment object (required fields)

  • type: "url" (hosted file) or "data_url" (base64 data URI)
  • data: public URL, or for data_url a full string data:<mimeType>;base64,<payload>
  • mimeType: must match the file (see table above)

For files you generate in n8n without a public URL, use data_url from a Code, HTTP Request, or Convert to File node. Prefer url for large media so the webhook payload stays small.

Image reply

The user receives this as a photo in Telegram

{
  "output": "Here is the image you asked for.",
  "attachments": [
    {
      "type": "url",
      "data": "https://example.com/result.jpg",
      "mimeType": "image/jpeg"
    }
  ]
}

Voice note (OGG Opus)

Use this when the user should get a native Telegram voice message (short spoken reply). The JSON structure is the same as for any attachment; set mimeType to audio/ogg and supply an OGG Opus file (URL or data_url).

{
  "output": "Here is a quick voice reply.",
  "attachments": [
    {
      "type": "url",
      "data": "https://example.com/reply.ogg",
      "mimeType": "audio/ogg"
    }
  ]
}

Audio file (MP3, WAV, WebM, …)

Use when you want the user to receive playable audio (longer clips, summaries, music-style content) as an audio attachment in Telegram rather than a compact voice message.

{
  "output": "Here is your audio summary.",
  "attachments": [
    {
      "type": "url",
      "data": "https://example.com/summary.mp3",
      "mimeType": "audio/mp3"
    }
  ]
}

Video

Delivered to the user as video in the chat.

{
  "output": "Here is the clip.",
  "attachments": [
    {
      "type": "url",
      "data": "https://example.com/clip.mp4",
      "mimeType": "video/mp4"
    }
  ]
}

Document or file

The user receives a downloadable document in Telegram.

{
  "output": "I have prepared your report.",
  "attachments": [
    {
      "type": "url",
      "data": "https://example.com/report.pdf",
      "mimeType": "application/pdf"
    }
  ]
}

Inline image with base64 (data_url)

Same end result as a photo in Telegram when the bytes come from n8n instead of a public URL (tiny example PNG; substitute your own payload):

{
  "output": "Here is the generated image.",
  "attachments": [
    {
      "type": "data_url",
      "data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
      "mimeType": "image/png"
    }
  ]
}

In n8n, build data with an expression, e.g. by prefixing data:image/png;base64, onto a base64 string from an upstream node.

Attachment only (no text)

Set output to "" when the user should only get the media (no caption). The same idea works for any mimeType.

{
  "output": "",
  "attachments": [
    {
      "type": "url",
      "data": "https://example.com/photo.jpg",
      "mimeType": "image/jpeg"
    }
  ]
}

Multiple attachments in one reply

DashLynk sends each attachment so the user gets every item (as separate Telegram messages when required).

{
  "output": "Here are both files:",
  "attachments": [
    {
      "type": "url",
      "data": "https://example.com/chart.png",
      "mimeType": "image/png"
    },
    {
      "type": "url",
      "data": "https://example.com/data.pdf",
      "mimeType": "application/pdf"
    }
  ]
}

Step 4: Assign a Client

  1. On the bot's config page, find Client association
  2. Select the client this bot belongs to from the dropdown and click Save assignment

Once assigned, all conversations from this bot appear in Dashboard > Conversations under that client, giving you full visibility into every exchange.

A Telegram bot can only be assigned to one client. This cannot be changed after saving.

Viewing and Monitoring Conversations

Once your bot is live, you no longer need to open n8n and scroll through execution logs to understand what happened in a conversation. Everything is captured and presented in a clean, chat-style view inside DashLynk, just like reading a WhatsApp conversation.

Go to Dashboard > Conversations, filter by client, and click any conversation to see the full message history between the user and your bot, including any media that was exchanged. Use this to review how your bot is performing, spot unexpected replies, and understand what your users are asking about.

Updating or Rotating Your Bot Token

If you ever need to replace your Telegram bot token:

  1. Go to the bot's config page
  2. Click the edit icon next to the masked token
  3. Paste the new token from BotFather and click Save Token

DashLynk validates the new token and keeps your workflow connection intact.

Deleting the Bot

Deleting a Telegram bot from DashLynk automatically disconnects it from Telegram as well. No manual cleanup is needed.