🔧 Create and manage short URLs with Telegram bot, MongoDB and Nginx redirects

269 views · 🔧 Miscellaneous

Description

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

This workflow allows you to create and manage custom short URLs directly via Telegram, with all data stored in MongoDB, and redirects handled efficiently via Nginx.

How it works

This flow provides a seamless URL shortening experience:

Set up steps

This setup is straightforward, especially if you already have a running n8n instance and a VPS.

Here’s MongoDB data structure JSON:

>[ {“_id”: “686a11946a48b580d72d0397”, “longUrl”: “https://longurl.com/abcdefghijklm/”, “shortUrl”: “short-code”} ]

Workflow Setup:

Crucial: Set an environment variable in your n8n instance (or .env file) named SHORTENER_DOMAIN with the value of your short URL domain (e.g., https://s.yourdomain.com).

Refer to sticky notes inside the workflows for detailed node configurations and expressions.

🔗 Nodes Used

Webhook, Telegram, Telegram Trigger, MongoDB

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup