The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Channel Failover Router",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "channel-status",
"responseMode": "lastNode",
"options": {}
},
"id": "cf-001",
"name": "Health Check Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
0,
0
]
},
{
"parameters": {
"jsCode": "// Check WhatsApp Cloud API status\nconst https = require('https');\n\n// WhatsApp Cloud API check (Meta's endpoint)\nconst options = {\n hostname: 'graph.facebook.com',\n port: 443,\n path: '/v18.0/me',\n method: 'GET',\n headers: {\n 'Authorization': 'Bearer ' + $env.WHATSAPP_TOKEN\n },\n timeout: 5000\n};\n\nreturn new Promise((resolve) => {\n const req = https.request(options, (res) => {\n resolve({ status: res.statusCode, channel: 'whatsapp', available: res.statusCode === 200 });\n });\n req.on('error', () => resolve({ status: 0, channel: 'whatsapp', available: false }));\n req.on('timeout', () => { req.destroy(); resolve({ status: 0, channel: 'whatsapp', available: false }); });\n req.end();\n});"
},
"id": "cf-002",
"name": "Check WhatsApp Status",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
200,
-100
]
},
{
"parameters": {
"jsCode": "// Check Telegram Bot API status\nconst https = require('https');\n\nconst options = {\n hostname: 'api.telegram.org',\n port: 443,\n path: '/bot' + $env.TELEGRAM_BOT_TOKEN + '/getMe',\n method: 'GET',\n timeout: 5000\n};\n\nreturn new Promise((resolve) => {\n const req = https.request(options, (res) => {\n let data = '';\n res.on('data', chunk => data += chunk);\n res.on('end', () => {\n try {\n const json = JSON.parse(data);\n resolve({ status: res.statusCode, channel: 'telegram', available: json.ok === true });\n } catch {\n resolve({ status: res.statusCode, channel: 'telegram', available: false });\n }\n });\n });\n req.on('error', () => resolve({ status: 0, channel: 'telegram', available: false }));\n req.on('timeout', () => { req.destroy(); resolve({ status: 0, channel: 'telegram', available: false }); });\n req.end();\n});"
},
"id": "cf-003",
"name": "Check Telegram Status",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
200,
100
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true
},
"conditions": [
{
"id": "cf-wa-up",
"leftValue": "={{$json.available}}",
"rightValue": true,
"operation": "equals"
},
{
"id": "cf-tg-up",
"leftValue": "={{$json.available}}",
"rightValue": true,
"operation": "equals"
}
]
},
"options": {}
},
"id": "cf-004",
"name": "Switch: Both Up",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
400,
0
]
},
{
"parameters": {
"respondWith": {
"respondWith": "json",
"responseBody": "={{ $json }}"
},
"options": {}
},
"id": "cf-005",
"name": "Both Available",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
600,
0
]
},
{
"parameters": {
"jsCode": "// Merge status from both channels\nconst wa = $input.all()[0].json;\nconst tg = $input.all()[1].json;\n\nconst result = {\n timestamp: new Date().toISOString(),\n whatsapp: { available: wa.available, status: wa.status },\n telegram: { available: tg.available, status: tg.status },\n primary: wa.available ? 'whatsapp' : (tg.available ? 'telegram' : 'none'),\n failover_cta: wa.available ? 'https://t.me/buncheng' : 'https://wa.me/2347032981049'\n};\n\nreturn [{ json: result }];"
},
"id": "cf-006",
"name": "Merge Status",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
400,
200
]
},
{
"parameters": {
"respondWith": {
"respondWith": "json",
"responseBody": "={{ $json }}"
},
"options": {}
},
"id": "cf-007",
"name": "Return Status",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
600,
200
]
}
],
"connections": {
"Health Check Webhook": {
"main": [
[
{
"node": "Check WhatsApp Status",
"type": "main",
"index": 0
},
{
"node": "Check Telegram Status",
"type": "main",
"index": 0
}
]
]
},
"Check WhatsApp Status": {
"main": [
[
{
"node": "Merge Status",
"type": "main",
"index": 0
}
]
]
},
"Check Telegram Status": {
"main": [
[
{
"node": "Merge Status",
"type": "main",
"index": 0
}
]
]
},
"Merge Status": {
"main": [
[
{
"node": "Return Status",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"saveManualExecutions": false,
"timezone": "Africa/Lagos"
},
"staticData": null,
"tags": [
"infrastructure",
"failover",
"health-check"
]
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Channel Failover Router. Webhook trigger; 7 nodes.
Source: https://github.com/sonnyagent30-beep/bunche/blob/e991131928c348097e3fb411d5caa3b0466900f8/.n8n/workflows/channel-failover.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
A production-ready authentication workflow implementing secure user registration, login, token verification, and refresh token mechanisms. Perfect for adding authentication to any application without
Portfolio Orchestrator. Uses httpRequest. Webhook trigger; 59 nodes.
This n8n template demonstrates how a simple Multi-Layer Perceptron (MLP) neural network can predict housing prices. The prediction is based on four key features, processed through a three-layer model.
github code Try yourself
This workflow receives new consult bookings via webhook (Calendly v2 or a generic scheduling tool), generates timed confirmation and reminder messages, runs each SMS through a separate compliance work