---
title: "Deploy n8n Telegram Bot"
description: "self-hosted Telegram bot with n8n"
category: "Automation"
url: https://railway.com/deploy/n8n-telegram-bot
---

# Deploy n8n Telegram Bot

self-hosted Telegram bot with n8n

**[Deploy n8n Telegram Bot on Railway](https://railway.com/template/n8n-telegram-bot)**

- **Creator:** onepush
- **Category:** Automation

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### n8n

- **Image:** n8nio/n8n:2.36.8
- **Health check:** /healthz
- **Public domain:** Yes

### n8n-worker

- **Image:** n8nio/n8n:2.36.8
- **Start command:** `n8n worker`
- **Health check:** /healthz

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

# Deploy and Host self hosted n8n Telegram Bot (Open-Source Telegram Automation) on Railway

n8n Telegram Bot is a self-hosted Telegram bot host: Telegram Trigger webhooks, BotFather tokens, AI replies, and Switch routing on queue-mode n8n. The editor registers HTTPS webhooks; workers run inbound updates. For a small instance without workers, use the [cheapest n8n without queue mode](https://railway.com/deploy/n8n). Store the BotFather token in n8n credentials, not in a node parameter, so workers can decrypt it with the shared encryption key.

## About Hosting n8n Telegram Bot open-source software on Railway (self hosted n8n template)

Self hosting n8n Telegram Bot keeps bot tokens, chat payloads, and reply logic on your stack. Telegram pushes updates to your public HTTPS `WEBHOOK_URL`. The editor takes UI and webhooks; workers pull from Redis and write to Postgres. Railway wires networking, `/home/node/.n8n`, and HTTPS.

## Why Deploy n8n Telegram Bot, the ManyChat alternative on Railway (Railway Free Trial)

ManyChat bills by active contacts; Zapier Telegram meters tasks. Self hosted n8n Telegram Bot on Railway is typically $10-$25/month for editor, worker, Postgres, and Redis with unlimited Community runs. n8n Cloud Starter is about $24/month for 2,500 executions. Railway gives a $5 free trial.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying n8n Telegram Bot on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for n8n Telegram Bot self hosting

| Provider          | What You Get with Railway                                    | What You Get with the Other Provider                       |
| ----------------- | ------------------------------------------------------------ | ---------------------------------------------------------- |
| **DigitalOcean**  | One-click editor, worker, Postgres, Redis, volume, and HTTPS | Droplet, Docker Compose, Nginx, SSL, and firewall by hand  |
| **AWS**           | Transparent usage pricing and private service DNS            | ECS, RDS, ElastiCache, IAM, and VPC work before n8n boots  |
| **Hetzner**       | Managed queue mode without SSH                               | Low VPS cost, but you operate Redis, Postgres, and workers |

## Common Use Cases for hosted n8n Telegram Bot

Common use cases for n8n Telegram Bot:

* Telegram Trigger → Agent or Switch: route `/start`, callbacks, and free text into AI replies.
* Shop alerts: Shopify, Stripe, or cron digests pushed to a Telegram chat or channel.
* Support bot: FAQ answers, ticket logs to Sheets or Notion, handoff via Telegram Send.
* AI replies: Agent nodes call HTTP APIs, then Telegram Send returns the answer. Needs public HTTPS `WEBHOOK_URL`.

## Dependencies for n8n Telegram Bot Docker hosted on Railway

Queue-mode n8n for Telegram bots needs PostgreSQL, Redis as the Bull queue, a volume for the encryption key, and a worker sharing the image tag and `N8N_ENCRYPTION_KEY` as the editor.

### Deployment Dependencies for Managed n8n Telegram Bot Service (OSS Telegram Automation)

Managed n8n Telegram Bot on Railway uses official `n8nio/n8n:2.36.8` for editor and worker, Postgres (`DB_TYPE=postgresdb`), Redis for `QUEUE_BULL_REDIS_HOST`, volume `/home/node/.n8n`, and a public domain on port 5678 with `/healthz`.

### Implementation Details for n8n Telegram Bot (Using n8n official docker image)

This template runs official `n8nio/n8n:2.36.8` (do not ship `latest`). The editor uses `EXECUTIONS_MODE=queue` and serves the UI plus Telegram webhooks. The worker starts with `n8n worker`. Both must share `N8N_ENCRYPTION_KEY` or credentials fail silently. Set `WEBHOOK_URL=https://${{n8n.RAILWAY_PUBLIC_DOMAIN}}`, `N8N_PROTOCOL=https`, `N8N_PROXY_HOPS=1`, `GENERIC_TIMEZONE` plus `TZ`, and `EXECUTIONS_DATA_PRUNE=true`. SQLite cannot run queue mode.

## How does n8n Telegram Bot compare against other Telegram Automation platforms

### n8n Telegram Bot vs ManyChat (ManyChat Alternative)
* **Billing:** ManyChat scales with active contacts. Self hosted n8n is flat Railway compute plus unlimited Community runs.
* **Data ownership:** Bot tokens and history stay in your Postgres. ManyChat is SaaS-only.

### n8n Telegram Bot vs Botpress (Botpress Alternative)
* **Platform focus:** Botpress is a conversation-metered AI agent studio. n8n is a canvas with Telegram Trigger, Switch, HTTP, and AI Agent nodes.
* **Self hosting:** Bot runtime stays on your workers; Botpress Cloud meters conversations.

### n8n Telegram Bot vs Telegram Bot API DIY (Telegram Bot API Alternative)
* **Builder speed:** Raw Bot API means hand-written `setWebhook` and deploys. n8n registers the webhook when you activate Telegram Trigger.
* **Ops:** DIY still needs HTTPS. This template ships editor, worker, Postgres, and Redis so updates run off the UI.

### n8n Telegram Bot vs Zapier Telegram (Zapier Telegram Alternative)
* **Billing:** Zapier bills each Telegram action as a task. Self hosted n8n counts one execution per run with no per-task fee on Community Edition.
* **Workers:** Queue workers absorb bursty Telegram traffic. Zapier Telegram is cloud-only.

## How to use n8n Telegram Bot (the OSS Telegram Automation)?

Deploy this template, wait for editor, worker, Postgres, and Redis, then open the HTTPS domain and create the owner account. Create a bot with BotFather, add a Telegram API credential and Telegram Trigger, set `WEBHOOK_URL` to your Railway HTTPS domain, activate so n8n calls `setWebhook`, and publish. Route with Switch or AI Agent, then Telegram Send. Scale workers as needed.

## How to self host n8n Telegram Bot on other VPS Services (n8n Telegram Bot self hosting guide)

### Clone the Repository
Download **n8n** from [GitHub](https://github.com/n8n-io/n8n) or pull `n8nio/n8n:2.36.8`.

### Install Dependencies
Install Docker and Docker Compose. Queue mode needs PostgreSQL 16-18, Redis, and RAM for the editor plus one worker.

### Configure Environment Variables
Set the same values on main and workers:
* `EXECUTIONS_MODE=queue`
* `DB_TYPE=postgresdb` with matching Postgres host, user, password, and database
* `QUEUE_BULL_REDIS_HOST` / `PORT` / `PASSWORD`
* `N8N_ENCRYPTION_KEY` (identical on every process, never rotate casually)
* `WEBHOOK_URL=https://your-domain` and `N8N_PROXY_HOPS=1` behind a reverse proxy

### Start the n8n Telegram Bot Application
Start Postgres and Redis, then the editor on port 5678 and `n8n worker` as a second container. Put TLS in front of 5678. On Railway this layout is already split into services.

## Official Pricing of n8n Telegram Bot (n8n Telegram Bot pricing)
n8n Community Edition is free to self-host under the fair-code Sustainable Use License. No per-execution fee on self-hosted Community. n8n Cloud Starter is around $24/month for 2,500 executions. SSO/SAML need Business/Enterprise. Community Edition has no SSO. You pay Railway for compute, Postgres, Redis, and the volume.

## n8n Telegram Bot cloud vs self hosted comparison (Pricing, features, costs, and more)
n8n Cloud is convenient and capped. Self hosted n8n Telegram Bot on Railway is unlimited Community executions, your encryption key, community nodes Cloud blocks, workers for Telegram bursts, and HTTPS for webhooks.

### Monthly cost of self hosting n8n Telegram Bot on Railway
Typical cost for editor + worker + Postgres + Redis is about $10-$25/month depending on worker CPU, Telegram traffic, and disk. Heavy AI workflows need more RAM. The [cheapest n8n without queue mode](https://railway.com/deploy/n8n) costs less with no worker or Redis.

### System Requirements for Hosting n8n Telegram Bot on a VPS
Plan for 2 vCPUs and 4GB RAM as a baseline (editor idle is hundreds of MB, spikes toward 1-2GB, plus Postgres and Redis). Store workflows on Postgres, keep `/home/node/.n8n` on disk, and expose 5678 behind HTTPS.

## Frequently Asked Questions (FAQs)

### What is n8n Telegram Bot self hosted?
n8n Telegram Bot self hosted means running Community Edition with Telegram Trigger and Send on an editor, Redis queue, Postgres, and workers so BotFather bots get HTTPS webhooks on your stack instead of Cloud.

### How do I connect BotFather and set the Telegram webhook in n8n?
Create a bot with BotFather, paste the token into a Telegram API credential, add a Telegram Trigger, set `WEBHOOK_URL` to your public HTTPS Railway domain, then activate. n8n registers `setWebhook`. One Telegram Trigger per bot token.

### How much does n8n Telegram Bot self hosting cost on Railway?
This workers template typically runs about $10-$25/month on Railway for editor, worker, Postgres, and Redis with unlimited Community Edition executions.

### Is n8n Telegram Bot free to use?
Yes. Community Edition is free to self-host. You pay only for infrastructure. Cloud plans and enterprise features (SSO, multi-main) are paid. Check the fair-code license before offering n8n as a hosted service.

### Why do Telegram bots need WEBHOOK_URL and queue workers?
Telegram requires a public HTTPS webhook URL; without `WEBHOOK_URL` and `N8N_PROXY_HOPS=1`, Trigger activation fails. Queue workers (`EXECUTIONS_MODE=queue`, `n8n worker`) run updates off the editor. Set `N8N_ENCRYPTION_KEY` and `EXECUTIONS_DATA_PRUNE`.

### What are some alternatives to n8n Telegram Bot?
ManyChat, Botpress, Telegram Bot API DIY, Zapier Telegram, and n8n Cloud. n8n Telegram Bot is the self-hosted canvas with workers. For a lighter instance use the [cheapest n8n without queue mode](https://railway.com/deploy/n8n).
 Telegram needs a stable public HTTPS URL; Railway’s domain is that URL for setWebhook.
 Telegram needs a stable public HTTPS URL; Railway’s domain is that URL for setWebhook.


## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Build a WhatsApp automation platform with Evolution API, n8n & Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/n8n-telegram-bot
