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 →
{
"nodes": [
{
"id": "e2f9ef65-5b0e-4fc6-9d2a-c84f6bf21019",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
0,
400
],
"parameters": {
"httpMethod": "POST",
"path": "wm-chat-v3",
"responseMode": "lastNode",
"options": {}
}
},
{
"id": "c40d3d4b-6b0c-4f8a-bf2a-dcb4583fd043",
"name": "Parse iHelp Body",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
220,
400
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const body = $json.body || {};\nconst contact = body.contact || {};\nconst tel = String(contact.number || '').replace(/\\D/g, '');\nconst push_name = String(contact.pushName || '').trim();\nconst accumulated_text = String(body.accumulatedText || '').trim();\nconst messages = Array.isArray(body.messages) ? body.messages : [];\nconst audio_urls = messages.filter(m => String(m.type) === '4' && m.mediaUrl).map(m => 'https://images.ihelpchat.com/' + m.mediaUrl);\nconst attendance_id_ref = String(body.attendanceIdRef || '');\nconst now_ms = Date.now();\nif (!tel || tel.length < 10) {\n return { json: { ok: false, error: 'invalid_phone', tel } };\n}\nreturn { json: { ok: true, tel, push_name, accumulated_text, audio_urls, attendance_id_ref, now_ms } };"
}
},
{
"id": "dbdd478c-5e10-410b-8b8c-98bbe76c0769",
"name": "Preprocess",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
440,
400
],
"parameters": {
"method": "POST",
"url": "https://ia-n8n.clalha.easypanel.host/webhook/wm-pre-v3",
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ accumulated_text: $json.accumulated_text, audio_urls: $json.audio_urls }) }}",
"options": {}
}
},
{
"id": "90f2af8e-ff16-45e1-9f3a-86a5f42d3912",
"name": "Merge Text",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
660,
400
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const up = $('Parse iHelp Body').item.json;\nconst pp = $json;\nreturn { json: { ...up, text: pp.text || up.accumulated_text, has_audios: !!pp.has_audios, transcripts: pp.transcripts || [] } };"
}
},
{
"id": "94fde817-fce1-4036-b8ac-c780c384087e",
"name": "Get State",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
880,
400
],
"parameters": {
"method": "POST",
"url": "https://ia-n8n.clalha.easypanel.host/webhook/wm-se-v3",
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ tel: $json.tel, action: 'get', params: {} }) }}",
"options": {}
}
},
{
"id": "8ff67255-3f62-48e6-9472-5ab7391ef683",
"name": "Merge State",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1100,
400
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const up = $('Merge Text').item.json;\nconst st = $json;\nreturn { json: { ...up, state: st.state, state_existed: st.extra && st.extra.state_existed } };"
}
},
{
"id": "7906c138-17fa-46a4-94f5-80eddecb7f49",
"name": "Guard Bot Active",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1320,
400
],
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c_enabled",
"leftValue": "={{ $json.state.bot.enabled }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
},
{
"id": "c_notpaused",
"leftValue": "={{ ($json.state.bot.paused_until_ms || 0) < $json.now_ms }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
}
},
{
"id": "b5a88dc4-8ae4-4493-b902-13de34145f4e",
"name": "Switch Journey Step",
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
1540,
300
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"leftValue": "={{ $json.state.journey.step }}",
"rightValue": "new",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "c_new"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "new"
}
]
},
"options": {
"fallbackOutput": "extra",
"renameFallbackOutput": "other"
}
}
},
{
"id": "ad4f36fa-6b80-4201-b0a4-5be81657a898",
"name": "Move Stage 706",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1760,
200
],
"parameters": {
"method": "POST",
"url": "https://ia-n8n.clalha.easypanel.host/webhook/wm-actions-v3",
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ kind: 'move_stage', tel: $json.tel, params: { stage_id: '706' } }) }}",
"options": {}
}
},
{
"id": "b06ce887-b265-4870-8f8a-115af1c6069c",
"name": "Send Audio 1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1980,
200
],
"parameters": {
"method": "POST",
"url": "https://ia-n8n.clalha.easypanel.host/webhook/wm-actions-v3",
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ kind: 'send_audio', tel: $('Merge State').item.json.tel, params: { audio_key: 'abertura_1' } }) }}",
"options": {}
}
},
{
"id": "d49421d1-d5ae-4b6a-8a68-b36e98be05be",
"name": "Send Audio 2",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2200,
200
],
"parameters": {
"method": "POST",
"url": "https://ia-n8n.clalha.easypanel.host/webhook/wm-actions-v3",
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ kind: 'send_audio', tel: $('Merge State').item.json.tel, params: { audio_key: 'abertura_2' } }) }}",
"options": {}
}
},
{
"id": "e0f9d4c0-df4c-443f-87fd-56fad4adb54d",
"name": "Send Aulas Link",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2420,
200
],
"parameters": {
"method": "POST",
"url": "https://ia-n8n.clalha.easypanel.host/webhook/wm-actions-v3",
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ kind: 'send_aulas_link', tel: $('Merge State').item.json.tel, params: {} }) }}",
"options": {}
}
},
{
"id": "355ede01-be66-4c5b-a1e3-5385ffe47bca",
"name": "Humanize & Send New",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2640,
200
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const up = $('Merge State').item.json;\nconst STAGE_URL = 'https://ia-n8n.clalha.easypanel.host/webhook/wm-actions-v3';\nconst text = 'Quando finalizar as aulas, s\u00f3 me avisar aqui que seguimos com a prova';\nconst chunks = text.split(/\\n\\n+/).map(c => c.trim()).filter(Boolean);\nconst results = [];\nfor (const chunk of chunks) {\n const delay = Math.min(600 + chunk.length * 35, 6000) + Math.floor(Math.random() * 400);\n await new Promise(r => setTimeout(r, delay));\n const res = await this.helpers.httpRequest({\n method: 'POST',\n url: STAGE_URL,\n headers: {'Content-Type': 'application/json'},\n body: { kind: 'send_text', tel: up.tel, params: { text: chunk } },\n json: true\n });\n results.push({ chunk, ok: res && res.ok !== false });\n}\nreturn { json: { ok: true, branch: 'new', chunks: chunks.length, results } };"
}
},
{
"id": "7320130a-557c-4779-b9f1-3c434ba06520",
"name": "Transition New\u2192Abertura",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2860,
200
],
"parameters": {
"method": "POST",
"url": "https://ia-n8n.clalha.easypanel.host/webhook/wm-se-v3",
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ tel: $('Merge State').item.json.tel, action: 'transition', params: { intent: 'has_push_name' } }) }}",
"options": {}
}
},
{
"id": "440cac0d-3168-4836-849c-bdf567a0abe0",
"name": "Humanize & Send Fallback",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1760,
400
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const up = $('Merge State').item.json;\nconst STAGE_URL = 'https://ia-n8n.clalha.easypanel.host/webhook/wm-actions-v3';\nconst text = 'Recebi sua mensagem, em instantes te respondo';\nconst chunks = text.split(/\\n\\n+/).map(c => c.trim()).filter(Boolean);\nfor (const chunk of chunks) {\n const delay = Math.min(600 + chunk.length * 35, 6000) + Math.floor(Math.random() * 400);\n await new Promise(r => setTimeout(r, delay));\n await this.helpers.httpRequest({\n method: 'POST',\n url: STAGE_URL,\n headers: {'Content-Type': 'application/json'},\n body: { kind: 'send_text', tel: up.tel, params: { text: chunk } },\n json: true\n });\n}\nreturn { json: { ok: true, branch: 'fallback', step: up.state.journey.step, text } };"
}
},
{
"id": "7bdefd20-bb51-497d-8e61-b6b537397839",
"name": "Respond Inactive",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1540,
600
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const s = $json.state || {};\nreturn { json: { ok: true, skipped: true, reason: s.bot && s.bot.enabled === false ? 'bot_disabled' : 'bot_paused', paused_until_ms: s.bot && s.bot.paused_until_ms } };"
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Parse iHelp Body",
"type": "main",
"index": 0
}
]
]
},
"Parse iHelp Body": {
"main": [
[
{
"node": "Preprocess",
"type": "main",
"index": 0
}
]
]
},
"Preprocess": {
"main": [
[
{
"node": "Merge Text",
"type": "main",
"index": 0
}
]
]
},
"Merge Text": {
"main": [
[
{
"node": "Get State",
"type": "main",
"index": 0
}
]
]
},
"Get State": {
"main": [
[
{
"node": "Merge State",
"type": "main",
"index": 0
}
]
]
},
"Merge State": {
"main": [
[
{
"node": "Guard Bot Active",
"type": "main",
"index": 0
}
]
]
},
"Guard Bot Active": {
"main": [
[
{
"node": "Switch Journey Step",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond Inactive",
"type": "main",
"index": 0
}
]
]
},
"Switch Journey Step": {
"main": [
[
{
"node": "Move Stage 706",
"type": "main",
"index": 0
}
],
[
{
"node": "Humanize & Send Fallback",
"type": "main",
"index": 0
}
]
]
},
"Move Stage 706": {
"main": [
[
{
"node": "Send Audio 1",
"type": "main",
"index": 0
}
]
]
},
"Send Audio 1": {
"main": [
[
{
"node": "Send Audio 2",
"type": "main",
"index": 0
}
]
]
},
"Send Audio 2": {
"main": [
[
{
"node": "Send Aulas Link",
"type": "main",
"index": 0
}
]
]
},
"Send Aulas Link": {
"main": [
[
{
"node": "Humanize & Send New",
"type": "main",
"index": 0
}
]
]
},
"Humanize & Send New": {
"main": [
[
{
"node": "Transition New\u2192Abertura",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Wm-Chat-Main-2A.N8N-Import. Uses httpRequest. Webhook trigger; 16 nodes.
Source: https://gist.github.com/bruunofco/492c7bc4a5aa9b163e3d3fd26d9e703c — 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.
This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di
This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .
This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c
Sign PDF documents with legally-compliant digital signatures using X.509 certificates. Supports multiple PAdES signature levels (B, T, LT, LTA) with optional visible stamps.
📡 This workflow serves as the central Alpha Vantage API fetcher for Tesla trading indicators, delivering cleaned 20-point JSON outputs for three timeframes: , , and . It is required by the following a