
Building automated workflows that connect Telegram with other services is extremely valuable for modern businesses and developers.
n8n provides a powerful platform for creating these automations, while
Telegram offers an excellent messaging interface for users to interact with your automated systems.
However, when developing locally, connecting Telegram webhooks to your self-hosted n8n instance can be challenging since Telegram requires HTTPS endpoints. This is where
Pinggy becomes invaluable, providing instant HTTPS tunnels to your local development environment without any complex setup.
Summary
Quick Setup Guide
- Create Telegram bot via BotFather (
/newbot
command) - Expose n8n with Pinggy:
ssh -p 443 -R0:localhost:5678 qr@free.pinggy.io
- Install n8n with webhook URL:
npm i n8n -g && WEBHOOK_URL="https://your-pinggy-url.a.pinggy.link" n8n start
- Configure Telegram Trigger node with bot token
- Set webhook:
https://api.telegram.org/bot<token>/setWebhook?url=<webhook_url>
- Add response node with Chat ID:
={{$json["message"]["chat"]["id"]}}
- Execute workflow and test with
/start
command - Browse n8n workflow templates
Popular Use Cases
- Automated customer support responses
- Real-time notifications and alerts
- Data collection and processing
- Integration with CRM and business tools
- AI-powered chatbots and assistants
Why integrate Telegram with n8n?
Telegram’s robust Bot API combined with n8n’s visual workflow automation creates powerful possibilities for businesses and developers. This integration enables you to build sophisticated automation systems that can handle customer inquiries, process data, send notifications, and integrate with hundreds of other services.
Real-time communication - Telegram bots provide instant messaging capabilities, making them perfect for time-sensitive notifications, alerts, and customer interactions.
Rich media support - Beyond text messages, you can send images, documents, location data, and interactive keyboards, creating engaging user experiences.
Scalable automation - n8n’s visual workflow builder lets you create complex automation logic without extensive coding, while still offering the flexibility to add custom JavaScript when needed.
Setting up Your Development Environment
Before diving into the Telegram integration, you’ll need to prepare your local development environment with the necessary tools, services, and configurations.
Prerequisites
Make sure you have the following installed and set up on your system:
- Node.js (v16 or above) - Check with:
node -v
- npm (comes with Node.js) - Check with:
npm -v
- Docker (optional, if you prefer running n8n in a container) - Check with:
docker -v
- SSH client (for Pinggy tunneling) - Available by default on most systems
- Telegram Bot Token
You’ll need to create a bot using
@BotFather and get the token to connect it with n8n.
Creating your Telegram bot
Every Telegram integration starts with creating a bot through BotFather:
- Open Telegram and search for “BotFather” (@BotFather)

- Start a conversation and send the command
/newbot

- Follow the instructions to name your bot and create a username

- BotFather will provide an API token that looks like:
123456789:ABCDefGhIJKlmNoPQRsTUVwxyZ

This token is crucial as it authenticates your bot with Telegram’s servers and allows n8n to send and receive messages.
Exposing n8n with Pinggy for webhook integration
The challenge with local n8n development is that Telegram webhooks require HTTPS endpoints, but your local instance runs on HTTP. Traditional solutions involve complex SSL certificate setup or paid tunneling services.
Pinggy solves this elegantly by providing instant HTTPS tunnels with a single command:
ssh -p 443 -R0:localhost:5678 qr@free.pinggy.io
This command creates a secure tunnel from Pinggy’s servers to your local n8n instance, providing you with an HTTPS URL like https://randomstring.a.pinggy.link
that Telegram can use for webhooks.

The benefits of using Pinggy include:
- Instant setup - No configuration files or complex setup procedures
- Automatic HTTPS - SSL certificates are handled automatically
- Reliable connection - Built-in reconnection and keepalive features
- No downloads required - Works with standard SSH client
Installing n8n Locally
Now that you have your Pinggy tunnel ready, you need to install and configure n8n to work with it. You can run n8n using npm or Docker, depending on your preference.
Option 1: Using npm
- Install n8n globally:
- Start n8n with your Pinggy webhook URL:
WEBHOOK_URL="https://your-pinggy-url.a.pinggy.link" n8n start
Important: Replace your-pinggy-url.a.pinggy.link
with the actual URL provided by Pinggy. Setting the WEBHOOK_URL
environment variable is essential for Telegram webhooks to work properly.

Option 2: Using Docker
If you prefer using Docker, run the following command:
docker run -it --rm --name n8n \
-p 5678:5678 \
-e WEBHOOK_URL="https://your-pinggy-url.a.pinggy.link" \
n8nio/n8n
Once n8n is running, open your browser and navigate to http://localhost:5678
to access the n8n interface. You’ll be prompted to create an account and can then start building your automation workflows.
Configuring the Telegram integration in n8n
With your tunnel established, you can now configure the Telegram integration within n8n:
Adding the Telegram Trigger node
- Create a new workflow in n8n
- Add a “Telegram Trigger” node from the node palette

Click on “Create New Credential” next to the credentials dropdown
Enter your bot token from BotFather

- Save the First Node

Connect Telegram Bot to Webhook
After saving your first node, you need to connect your Telegram bot to the webhook URL. Copy the webhook URL from first node:

https://api.telegram.org/bot<your_bot_token>/setWebhook?url=<your_webhook_url>
Example:
https://api.telegram.org/bot123456789:ABCdefGhIjKlmNoPQRstUvWXyZ1234567890/setWebhook?url=https://rnwuh-14-143-171-146.a.free.pinggy.link/webhook-test/d2002f4c-6fc8-46de-9fd2-b430b2a2a77f/webhook
You’ll get a response like:
{"ok":true,"result":true,"description":"Webhook was set"}

Add Response Node
Now let’s create a simple response workflow. Add a Telegram node after the trigger:
- Resource: Message
- Operation: Send Message
- Chat ID:
={{$json["message"]["chat"]["id"]}}
- Text: “Hello, your message was received!”

Testing the workflow
Now it’s time to test your complete workflow:
- Execute the workflow - Click the “Execute Workflow” button in n8n to activate it
- Test with your bot - Open Telegram and send
/start
to your bot - Verify the response - You should receive the message “Hello, your message was received!”
- Check n8n execution - Return to n8n to see the workflow execution data and confirm everything worked

If the test is successful, your bot is now ready to receive and respond to messages through the Pinggy tunnel!
Conclusion
Integrating Telegram with n8n using Pinggy creates a powerful foundation for building automated communication workflows. The combination of Telegram’s rich messaging capabilities, n8n’s visual workflow builder, and Pinggy’s seamless tunneling solution enables developers to quickly prototype and test sophisticated automation systems.
Whether you’re building customer support bots, notification systems, or complex multi-service integrations, this stack provides the flexibility and reliability needed for modern automation challenges. Start with simple workflows and gradually expand your automation capabilities as your needs grow.
The key to success lies in understanding your users’ needs, designing intuitive conversation flows, and leveraging n8n’s extensive integration ecosystem to connect Telegram with the tools and services that power your business.