Create and Manage Short URLs with Telegram Bot, MongoDB and Nginx Redirects — n8n 工作流

复杂度 触发器22 个节点🏷️ Miscellaneous作者:Rudi Afandi

概览

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:

Create via Telegram: Send a long URL to your bot. It will ask if you want a custom short code.

Store in MongoDB: All long URLs and their corresponding short cod

使用的节点

TelegramMongoDBCode

工作流预览

Validating
Link not valid
Creating new link
Handle Redirects
Link exist, ask another one
Workflow 1: Create Short URL
I. Main Message & Reply Detection
- Telegram Trigger: Receives all Telegram messages.
- Is it Reply? (IF): Checks if message is a reply.
- True: Reply (-> Code)
- Fal
Workflow 2: URL Redirect Handler
- Webhook (Webhook Trigger): Receives short URL request
- Data2 (Set): Extracts short code from webhook URL.
Exist?2 (MongoDB - Find): Finds orig
T
Telegram Trigger
Insert shortCode
New link
Exist?
N
no exist?
E
exist?
W
Webhook
I
Is it reply?
R
Reply Data
askShortCode
Clean Data
askShortCode1
V
Valid URL
take URL
N
Not Valid URL?
Not Valid URL1
T
take short code
short code exist?
S
short code exist?1
I
If short code exist
4
404 page
S
shortCode Data
22 nodes20 edges

工作原理

  1. 1

    触发器

    工作流由 触发器 触发器启动。

  2. 2

    处理

    数据流经 22 个节点, connecting code, if, mongodb。

  3. 3

    输出

    工作流完成自动化并将结果发送到配置的目标。

节点详情 (22)

TE

Telegram

telegram

#1
MO

MongoDB

mongoDb

#2
CO

Code

code

#3

如何导入此工作流

  1. 1点击右侧 下载 JSON 按钮保存工作流文件。
  2. 2打开你的 n8n 实例,依次点击 工作流 → 新建 → 从文件导入
  3. 3选择下载的 create-and-manage-short-urls-with-telegram-bot-mongodb-and-nginx-redirects 文件并点击导入。
  4. 4为每个服务节点配置 凭证(API 密钥、OAuth 等)。
  5. 5点击 测试工作流 验证一切正常,然后激活它。

或直接在 n8n → 从 JSON 导入 中粘贴:

{ "name": "Create and Manage Short URLs with Telegram Bot, MongoDB and Nginx Redirects", "nodes": [...], ...}

集成

codeifmongodbrespondtowebhooksettelegramtelegramtriggerwebhook

获取此工作流

一键下载并导入

下载 JSON在 n8n.io 上查看
节点22
复杂度high
触发器trigger

创建者

Rudi Afandi

Rudi Afandi

@fanfanra

标签

codeifmongodbrespondtowebhooksettelegramtelegramtriggerwebhook

n8n 新手?

n8n 是一款免费开源的工作流自动化工具,支持自托管或使用云版本。

免费获取 n8n →

Related Miscellaneous Workflows