npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-telegram-multi

v0.1.0

Published

n8n community node for multiple Telegram bots support

Readme

🤖 n8n-nodes-telegram-multi

npm version License: MIT

n8n community node for multiple Telegram bots support

This node solves the main limitation of the standard n8n Telegram node - supporting only one bot token per node. With Telegram Multi, you can use multiple bots in a single workflow with flexible authentication methods.

✨ Key Features

  • 🔒 Multiple Authentication Methods: Encrypted credentials, environment variables, or direct input
  • 🤖 Multiple Bot Support: Use different bots for different operations in one workflow
  • 🔄 Drop-in Replacement: Compatible with standard Telegram node operations
  • 🛡️ Security First: Three levels of security with token validation
  • 🚀 Production Ready: Complete error handling, validation, and timeout management

📦 Installation

npm install n8n-nodes-telegram-multi

Or install directly in n8n:

  1. Go to SettingsCommunity Nodes
  2. Enter: n8n-nodes-telegram-multi
  3. Install and restart n8n

🔐 Authentication Methods

1. 🔒 Encrypted Credentials (Most Secure)

Best for production use with sensitive tokens.

Authentication Method: Encrypted Credentials
Credentials: Select your Telegram Multi API credentials

2. 🔧 Environment Variable (Recommended)

Perfect for multiple bots and dynamic selection.

Authentication Method: Environment Variable
Environment Token: {{$env.BOT_TOKEN_NEWS}}

3. ⚠️ Direct Input (Development Only)

Quick testing only - not recommended for production.

Authentication Method: Direct Input  
Bot Token: 123456789:ABCdef...

🚀 Use Cases & Examples

Example 1: Multiple News Channels

Use different bots for different content categories:

// Function Node - Determine category
const category = $json.title.includes('crypto') ? 'crypto' : 'tech';

return {
  botToken: category === 'crypto' ? $env.BOT_TOKEN_CRYPTO : $env.BOT_TOKEN_TECH,
  chatId: category === 'crypto' ? '@crypto_news' : '@tech_news',
  message: $json.title
};
// Telegram Multi Node
Authentication Method: Environment Variable
Environment Token: {{$json.botToken}}
Resource: Message
Operation: Send  
Chat ID: {{$json.chatId}}
Text: {{$json.message}}

Example 2: Alert Priorities

Route different alert levels to different bots:

// Function Node - Alert routing
const alertBots = {
  'critical': $env.BOT_TOKEN_ALERTS,
  'warning': $env.BOT_TOKEN_WARNINGS, 
  'info': $env.BOT_TOKEN_INFO
};

return {
  botToken: alertBots[$json.severity],
  chatId: $json.severity === 'critical' ? '@critical_alerts' : '@general_alerts'
};

Example 3: Multi-tenant System

Different bots for different customers:

// Function Node - Customer routing
const customerBots = {
  'customer_a': $env.BOT_TOKEN_CUSTOMER_A,
  'customer_b': $env.BOT_TOKEN_CUSTOMER_B,
  'customer_c': $env.BOT_TOKEN_CUSTOMER_C
};

return {
  botToken: customerBots[$json.customer_id],
  chatId: $json.notification_chat
};

📋 Supported Operations

Message Operations

  • Send: Send text messages with formatting
  • Edit: Edit existing messages
  • Delete: Delete messages

Photo Operations

  • Send: Send photos with captions

Document Operations

  • Send: Send documents with captions

Chat Operations

  • Get: Get chat information
  • Get Administrators: Get list of chat administrators

⚙️ Configuration Options

Additional Fields

All operations support these additional options:

  • Parse Mode: HTML, Markdown, or MarkdownV2
  • Caption: For photos and documents
  • Disable Web Page Preview: Hide link previews
  • Disable Notification: Send silently
  • Reply to Message ID: Reply to specific message

Chat ID Formats

The node supports multiple chat ID formats:

  • Numeric ID: 123456789 (private chat)
  • Negative ID: -123456789 (group)
  • Username: @channel_name (public channel/group)

🔧 Environment Variables Setup

Create a .env file or set environment variables:

# Multiple bot tokens for different purposes
BOT_TOKEN_NEWS=1234567890:ABCDEF...
BOT_TOKEN_ALERTS=9876543210:GHIJKL...  
BOT_TOKEN_CRYPTO=5555555555:MNOPQR...
BOT_TOKEN_MINING=7777777777:STUVWX...
BOT_TOKEN_PERSONAL=3333333333:YZABCD...

🛡️ Security & Validation

The node includes comprehensive security features:

  • Token Validation: Ensures proper Telegram bot token format
  • Chat ID Validation: Validates numeric IDs and usernames
  • Input Sanitization: Prevents XSS and API issues
  • Error Handling: Network errors, timeouts, API errors
  • Rate Limiting: Built-in Telegram API rate limit support

📊 Comparison with Other Solutions

| Approach | Security | Convenience | Flexibility | Recommendation | |----------|----------|-------------|-------------|----------------| | HTTP Request | 🔒🔒 | ⭐⭐ | ⭐⭐⭐⭐⭐ | For complex cases | | Standard Telegram | 🔒🔒🔒🔒 | ⭐⭐⭐⭐⭐ | ⭐ | For single bot | | Telegram Multi | 🔒🔒🔒🔒 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | Best choice |

🚨 Error Handling

The node provides detailed error messages for common issues:

  • Invalid bot token format
  • Invalid chat ID format
  • Network connectivity issues
  • Telegram API errors
  • Message length limits
  • Rate limiting

Enable "Continue on Fail" in node settings to handle errors gracefully.

🔄 Migration from Standard Telegram Node

Migrating is simple:

  1. Replace Telegram node with Telegram Multi
  2. Set Authentication Method to "Encrypted Credentials"
  3. Select your existing Telegram credentials
  4. All other settings remain the same

📈 Advanced Examples

Dynamic Bot Selection

// Function Node - Advanced routing logic
const time = new Date().getHours();
const isWeekend = [0, 6].includes(new Date().getDay());
const priority = $json.priority;

let selectedBot;
if (priority === 'urgent') {
  selectedBot = $env.BOT_TOKEN_URGENT;
} else if (isWeekend || time < 8 || time > 18) {
  selectedBot = $env.BOT_TOKEN_AFTER_HOURS;
} else {
  selectedBot = $env.BOT_TOKEN_BUSINESS;
}

return { botToken: selectedBot };

Conditional Formatting

// Function Node - Message formatting
const status = $json.status;
const emoji = status === 'success' ? '✅' : status === 'error' ? '❌' : '⚠️';
const parseMode = $json.includeHtml ? 'HTML' : 'Markdown';

return {
  text: `${emoji} <b>Status:</b> ${status}\n<i>Details:</i> ${$json.details}`,
  parse_mode: parseMode
};

🐛 Troubleshooting

Common Issues

"Invalid bot token format"

  • Ensure token follows format: 123456789:ABCdef...
  • Check for extra spaces or characters

"Chat not found"

  • Verify chat ID format (@username or -123456789)
  • Ensure bot has access to the chat

"Environment variable not found"

  • Check variable spelling: {{$env.BOT_TOKEN_NAME}}
  • Verify environment variable is set

"Request timeout"

  • Check network connectivity
  • Try reducing message size

💡 Best Practices

  1. Use Environment Variables for production deployments
  2. Enable Error Handling with "Continue on Fail"
  3. Validate Chat IDs before sending messages
  4. Monitor Rate Limits for high-volume workflows
  5. Test Thoroughly in development environment first

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

🙋‍♂️ Support

🎉 Changelog

v0.1.0

  • Initial release
  • Multiple authentication methods
  • All basic Telegram operations
  • Comprehensive error handling
  • Full documentation and examples

Made with ❤️ for the n8n community