logo_smallAxellero.io

Telegram - Setup Guide

Setup and configuration guide for Telegram integration

Telegram Bot API integration for messaging automation with Axellero.

For detailed instructions on managing credentials, connectors, and triggers in Axellero Studio, see the Integration Guide.

Step 1: Create Credential

Getting Your Bot Token

  1. Open Telegram and search for @BotFather
  2. Send /newbot to start the creation process
  3. Enter a name for your bot (displayed in conversations)
  4. Enter a username for your bot (must end with bot, e.g., my_awesome_bot)
  5. Copy the Bot Token from BotFather's response

Example Token Format:

123456789:ABCdefGHIjklMNOpqrSTUvwxYZ1234567890

Recommended Bot Settings in BotFather:

CommandPurpose
/setdescriptionSet bot description (shown on profile)
/setuserpicSet bot profile picture
/setcommandsSet command menu
/setprivacyGroup privacy mode (disable for group bots)

Adding Credential to Axellero

  1. Navigate to Application > Integrations > Credentials
  2. Click "Add Credential"
  3. Select API Key
  4. Enter:
    • Name: "Telegram Bot - Production"
    • API Key: Bot token from BotFather
  5. Click Save

Step 2: Create Connector

  1. Navigate to Application > Integrations > Connectors
  2. Click "Add Connector"
  3. Select Telegram from the list
  4. Configure:
    • Name: "Telegram Bot - Production"
    • Credential: Select the credential you created
  5. Click Save
  6. Test the connection using the "Test" button (calls getMe)

The connector is now available in any workflow or agentflow.


Step 3: Create Trigger

For supported events and payload examples, see main documentation.

3.1 Create Trigger

  1. Navigate to Integrations > Triggers
  2. Click "Add Trigger" (+) button
  3. Select your Telegram connector
  4. Configure:
    • Secret Token: (Optional) Secret for webhook verification
    • Events: Select update types (message, callback_query, etc.)
  5. Click Save

How it works: Axellero automatically generates a webhook URL and registers it with Telegram via the setWebhook API. No manual webhook setup required.

3.2 Add Trigger to Workflow

  1. Open Workflow Builder
  2. Find your trigger in the Triggers section
  3. Drag to canvas as starting node
  4. Build workflow logic after the trigger

3.3 Test the Trigger

  1. Send a message to your bot in Telegram
  2. Check workflow execution logs in Axellero
  3. Verify trigger data via {{ctx.nodes.telegram_trigger.outputs.data}}

Workflow Examples

Example 1: Echo Bot

Simple bot that echoes back user messages.

Workflow Steps:

  1. Telegram Trigger: Events = message
  2. Telegram - sendMessage: Reply with received text

Configuration:

{
  "chatId": "{{ctx.nodes.telegram_trigger.outputs.data.message.chat.id}}",
  "text": "You said: {{ctx.nodes.telegram_trigger.outputs.data.message.text}}"
}

Example 2: Interactive Button Bot

Send messages with inline keyboard buttons and handle callbacks.

Workflow Steps:

  1. Telegram Trigger: Events = message, callback_query
  2. Condition: Check if callback_query exists
  3. Telegram - sendMessage/answerCallbackQuery: Handle appropriately

sendMessage with Inline Keyboard:

{
  "chatId": "{{ctx.nodes.telegram_trigger.outputs.data.message.chat.id}}",
  "text": "Choose an option:",
  "replyMarkup": {
    "inline_keyboard": [
      [{"text": "Option 1", "callback_data": "opt1"}, {"text": "Option 2", "callback_data": "opt2"}]
    ]
  }
}

Example 3: Notification Bot

Send alerts from external systems to Telegram channels.

Workflow Steps:

  1. HTTP Trigger: Receive notification from external system
  2. Telegram - sendMessage: Forward to Telegram channel

Configuration:

{
  "chatId": "-1001234567890",
  "text": "*ALERT*: {{ctx.nodes.http_trigger.outputs.data.alertName}}",
  "parseMode": "MarkdownV2"
}

Example 4: Support Ticket Bot

Create Linear issues from Telegram messages.

Workflow Steps:

  1. Telegram Trigger: Events = message
  2. Linear - createIssue: Create issue with message content
  3. Telegram - sendMessage: Send ticket confirmation

Configuration:

{
  "chatId": "{{ctx.nodes.telegram_trigger.outputs.data.message.chat.id}}",
  "text": "Ticket created: {{ctx.nodes.linear_create.outputs.data.identifier}}"
}

Getting Chat IDs

  • Private chats: User must message bot first. Use getUpdates to get chat.id
  • Groups/Channels: Add bot, send message, use getUpdates. Group IDs are negative (e.g., -1001234567890)

Troubleshooting

ErrorCauseSolution
401 UnauthorizedInvalid tokenVerify token from BotFather
400 Chat not foundInvalid chat IDUser must start conversation first
403 Bot blockedUser blocked botCannot send until unblocked
403 Not a memberBot not in groupAdd bot to the group
409 Webhook activeConflicting methodsUse webhook OR getUpdates, not both
429 Too Many RequestsRate limitedWait for retry_after seconds

Common Issues

Bot can't see group messages

  • Disable privacy mode: BotFather -> /setprivacy -> "Disable"
  • Or make bot an administrator

Webhook not receiving updates

  • Verify HTTPS URL is publicly accessible
  • Check SSL certificate is valid
  • Ensure no conflicting getUpdates calls

Media upload fails

  • Max file size: 50 MB for photos/videos
  • Use direct URLs, not YouTube/share links

Security Best Practices

  • Store token in Axellero Credential Manager (encrypted storage)
  • Use secret_token for webhook verification
  • Never share bot token publicly
  • Regenerate with /revoke in BotFather if compromised
  • Periodically review bot permissions and connected chats

Resources