n8n Workflow Templates
Deploy production-ready n8n workflows in seconds. Five battle-tested templates plus management scripts for the complete n8n workflow lifecycle.
Quick Start
CODEBLOCK0
Templates
| Template | Description | Use Case |
|---|
| INLINECODE0 | Webhook receiver → Telegram alerts | Instant notifications from any service |
| INLINECODE1 |
RSS feed monitoring with filtering | Track blogs, news, releases |
|
health-check.json | HTTP health checks with alerts | Monitor services, APIs, websites |
|
social-metrics.json | Scheduled social media collection | Track followers, engagement |
|
data-backup.json | Automated backup with notifications | Database/file backups |
Detailed Usage
Environment Variables
| Variable | Required | Default | Description |
|---|
| INLINECODE5 | Yes | - | n8n instance URL |
| INLINECODE6 |
Yes | - | API key from n8n settings |
Deployment
CODEBLOCK1
Arguments:
- -
n8n-url - Full URL to n8n instance (e.g., http://10.0.0.120:5678) - INLINECODE9 - n8n API key
- INLINECODE10 - Path to workflow JSON file
- INLINECODE11 (optional) - Override the workflow name
Example:
CODEBLOCK2
Listing Workflows
CODEBLOCK3
Lists all active workflows with their IDs, names, and activation status.
Template Details
webhook-to-telegram
Receives HTTP POST requests, processes JSON payload, sends formatted messages to Telegram.
Webhook URL: INLINECODE12
Expected payload:
CODEBLOCK4
Required setup: Configure Telegram bot token and chat ID in the workflow.
rss-monitor
Monitors RSS feeds on schedule, filters by keywords, alerts on new items.
Features:
- - Runs every 15 minutes
- Keyword filtering (include/exclude)
- Duplicate detection
- Multi-channel alerts (Telegram, Discord, email)
Required setup: Set RSS feed URL and alert destination.
health-check
Performs HTTP health checks, alerts on failure, tracks response times.
Features:
- - Configurable check interval
- Response time thresholds
- Consecutive failure alerts
- Status history tracking
Required setup: Set target URLs and alert channels.
social-metrics
Collects social media metrics on schedule, stores for trending.
Features:
- - Daily metric collection
- Multi-platform support (X/Twitter, LinkedIn, etc.)
- Data storage in n8n or external DB
- Trend analysis ready
Required setup: Configure API credentials for each platform.
data-backup
Automated backup workflow with pre/post checks and notifications.
Features:
- - Schedule-based execution
- Pre-backup validation
- Backup verification
- Success/failure notifications
- Retention policy enforcement
Required setup: Configure backup source, destination, and credentials.
API Reference
The scripts use n8n REST API v1:
CODEBLOCK5
Full API docs: INLINECODE13
Customizing Templates
Templates are standard n8n workflow JSON. Edit in n8n UI or modify the JSON directly:
CODEBLOCK6
Troubleshooting
"Unauthorized" error
- - Verify API key is correct
- Check API key hasn't expired in n8n settings
"Connection refused"
- - Verify n8n is running
- Check N8N_HOST includes correct port
- Ensure firewall allows connection
Workflow won't activate
- - Check all credentials are configured in the workflow
- Verify webhook nodes don't conflict with existing webhooks
- Check n8n execution logs for errors
Template deployment fails
- - Validate JSON: INLINECODE14
- Check n8n version compatibility (templates tested on v1.0+)
Requirements
- - n8n instance v1.0 or later
- API access enabled in n8n settings
- curl and bash
- Network access to n8n instance
See Also
- - n8n Documentation: https://docs.n8n.io/
- n8n API Reference: https://docs.n8n.io/api/
- Workflow examples: https://n8n.io/workflows/
n8n 工作流模板
数秒内即可部署生产级 n8n 工作流。提供五个经过实战检验的模板以及覆盖完整 n8n 工作流生命周期的管理脚本。
快速开始
bash
设置 n8n 凭据
export N8N_HOST=http://localhost:5678
export N8N
APIKEY=n8n
apixxxxx
列出现有工作流
bash list-workflows.sh
部署模板
bash deploy.sh $N8N
HOST $N8NAPI_KEY templates/webhook-to-telegram.json
模板列表
| 模板 | 描述 | 使用场景 |
|---|
| webhook-to-telegram.json | Webhook 接收器 → Telegram 告警 | 从任何服务即时接收通知 |
| rss-monitor.json |
带过滤功能的 RSS 源监控 | 追踪博客、新闻、版本发布 |
| health-check.json | 带告警功能的 HTTP 健康检查 | 监控服务、API、网站 |
| social-metrics.json | 定时社交媒体数据采集 | 追踪粉丝数、互动量 |
| data-backup.json | 带通知功能的自动备份 | 数据库/文件备份 |
详细用法
环境变量
| 变量 | 是否必需 | 默认值 | 描述 |
|---|
| N8NHOST | 是 | - | n8n 实例 URL |
| N8NAPI_KEY |
是 | - | 从 n8n 设置中获取的 API 密钥 |
部署
bash
bash deploy.sh [workflow-name]
参数说明:
- - n8n-url - n8n 实例的完整 URL(例如 http://10.0.0.120:5678)
- api-key - n8n API 密钥
- template-file - 工作流 JSON 文件路径
- workflow-name(可选)- 覆盖工作流名称
示例:
bash
bash deploy.sh http://10.0.0.120:5678 n8napiabc123 templates/health-check.json 我的健康监控器
列出工作流
bash
bash list-workflows.sh
列出所有活跃工作流及其 ID、名称和激活状态。
模板详情
webhook-to-telegram
接收 HTTP POST 请求,处理 JSON 负载,向 Telegram 发送格式化消息。
Webhook URL: ${N8N_HOST}/webhook/workflow-id
预期负载格式:
json
{
message: 来自我的服务的告警,
level: warning,
timestamp: 2026-02-10T22:00:00Z
}
必要配置: 在工作流中配置 Telegram 机器人令牌和聊天 ID。
rss-monitor
按计划监控 RSS 源,通过关键词过滤,在新条目出现时发出告警。
功能特性:
- - 每 15 分钟运行一次
- 关键词过滤(包含/排除)
- 重复检测
- 多渠道告警(Telegram、Discord、邮件)
必要配置: 设置 RSS 源 URL 和告警目标。
health-check
执行 HTTP 健康检查,在失败时发出告警,追踪响应时间。
功能特性:
- - 可配置检查间隔
- 响应时间阈值
- 连续失败告警
- 状态历史追踪
必要配置: 设置目标 URL 和告警渠道。
social-metrics
按计划采集社交媒体指标,存储数据用于趋势分析。
功能特性:
- - 每日指标采集
- 多平台支持(X/Twitter、LinkedIn 等)
- 数据存储于 n8n 或外部数据库
- 趋势分析就绪
必要配置: 为每个平台配置 API 凭据。
data-backup
自动备份工作流,包含前后检查及通知功能。
功能特性:
- - 基于计划执行
- 备份前验证
- 备份验证
- 成功/失败通知
- 保留策略执行
必要配置: 配置备份源、目标和凭据。
API 参考
脚本使用 n8n REST API v1:
GET /api/v1/workflows # 列出工作流
POST /api/v1/workflows # 创建工作流
GET /api/v1/workflows/:id # 获取工作流
PUT /api/v1/workflows/:id # 更新工作流
POST /api/v1/workflows/:id/activate # 激活
POST /api/v1/workflows/:id/deactivate # 停用
完整 API 文档:${N8N_HOST}/api/v1/docs
自定义模板
模板为标准 n8n 工作流 JSON 格式。可在 n8n UI 中编辑或直接修改 JSON:
bash
复制并自定义
cp templates/health-check.json my-custom-check.json
使用你喜欢的编辑器编辑 my-custom-check.json
bash deploy.sh $N8N
HOST $N8NAPI_KEY my-custom-check.json
故障排除
Unauthorized 错误
- - 验证 API 密钥是否正确
- 检查 n8n 设置中 API 密钥是否过期
Connection refused 错误
- - 验证 n8n 是否正在运行
- 检查 N8N_HOST 是否包含正确端口
- 确保防火墙允许连接
工作流无法激活
- - 检查工作流中所有凭据是否已配置
- 验证 Webhook 节点不与现有 Webhook 冲突
- 查看 n8n 执行日志以获取错误信息
模板部署失败
- - 验证 JSON:python3 -c import json; json.load(open(template.json))
- 检查 n8n 版本兼容性(模板已在 v1.0+ 版本测试)
系统要求
- - n8n 实例 v1.0 或更高版本
- 在 n8n 设置中启用 API 访问
- curl 和 bash
- 能够访问 n8n 实例的网络
相关资源
- - n8n 文档:https://docs.n8n.io/
- n8n API 参考:https://docs.n8n.io/api/
- 工作流示例:https://n8n.io/workflows/