AutomationFlowsData & Sheets › Wm-stage-actions.n8n-import

Wm-stage-actions.n8n-import

Wm-Stage-Actions.N8N-Import. Uses httpRequest, postgres. Webhook trigger; 17 nodes.

Webhook trigger★★★★☆ complexity17 nodesHTTP RequestPostgres
Data & Sheets Trigger: Webhook Nodes: 17 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Postgres recipe pattern — see all workflows that pair these two integrations.

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 →

Download .json
{
  "nodes": [
    {
      "id": "148050c6-74aa-4381-a37c-664925f2466e",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "wm-actions-v3",
        "responseMode": "lastNode",
        "options": {}
      }
    },
    {
      "id": "6ed1e3eb-1465-405e-b05e-5ca6fb2a1da4",
      "name": "Parse Input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        0
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const body=$json.body||{};\nconst kind=String(body.kind||'').toLowerCase();\nconst tel=String(body.tel||'').replace(/\\D/g,'');\nif(!tel||tel.length<10) return { json:{ok:false,error:'invalid_phone',kind,tel,params:body.params||{}} };\nconst VALID=['send_text','send_audio','send_aulas_link','send_tally_link','move_stage','apply_tags'];\nif(!VALID.includes(kind)) return { json:{ok:false,error:'invalid_kind',kind,tel,params:body.params||{}} };\nreturn { json:{ok:true,kind,tel,params:body.params||{}} };"
      }
    },
    {
      "id": "2261f398-1bd0-41a2-a089-93a3adbd93a1",
      "name": "Switch Kind",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        440,
        0
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.kind }}",
                    "rightValue": "send_text",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c_send_text"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "send_text"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.kind }}",
                    "rightValue": "send_audio",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c_send_audio"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "send_audio"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.kind }}",
                    "rightValue": "send_aulas_link",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c_send_aulas_link"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "send_aulas_link"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.kind }}",
                    "rightValue": "send_tally_link",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c_send_tally_link"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "send_tally_link"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.kind }}",
                    "rightValue": "move_stage",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c_move_stage"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "move_stage"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.kind }}",
                    "rightValue": "apply_tags",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c_apply_tags"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "apply_tags"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "9e33bdd1-b900-4c7c-a79e-6b8dccf30449",
      "name": "Prep Text",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        -400
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return { json:{ ...$json, text: $json.params.text || '' } };"
      }
    },
    {
      "id": "6d2b8d50-7f2f-4901-8585-d5390d78ea73",
      "name": "HTTP Send Text",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        -400
      ],
      "parameters": {
        "method": "POST",
        "url": "https://apiv3.ihelpchat.com/api/v2/customers/send-message",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<redacted-credential>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={{ JSON.stringify({ canalId: '698f6ac2474ca125a518be8d', contato: $json.tel, messageType: 0, texto: $json.text }) }}",
        "options": {
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 2000
            }
          }
        }
      }
    },
    {
      "id": "a41b16c2-98f5-4f48-baf7-0f642eefccc2",
      "name": "Lookup Audio",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        660,
        -200
      ],
      "parameters": {
        "operation": "executeQuery",
        "query": "=SELECT ihelp_mensagem_id FROM wm_audios WHERE key='{{ $json.params.audio_key }}' AND active=true LIMIT 1;",
        "options": {}
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "e1d32037-e81d-44be-b941-a30ff2c24712",
      "name": "Merge Audio Id",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        -200
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const up=$('Parse Input').item.json;\nreturn { json:{ ...up, ihelp_mensagem_id: $json.ihelp_mensagem_id } };"
      }
    },
    {
      "id": "681f3130-8204-450a-a6e3-48b5aba37fae",
      "name": "HTTP Send Audio",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1100,
        -200
      ],
      "parameters": {
        "method": "POST",
        "url": "https://apiv3.ihelpchat.com/api/v2/customers/send-message",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<redacted-credential>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={{ JSON.stringify({ CanalId: '698f6ac2474ca125a518be8d', Contato: $json.tel, MensagemPersonalizadaId: Number($json.ihelp_mensagem_id) }) }}",
        "options": {
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 2000
            }
          }
        }
      }
    },
    {
      "id": "7a8d20f6-a1c9-4228-abd3-ccf3ee86dc25",
      "name": "Get Aulas URL",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        660,
        0
      ],
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT value#>>'{}' AS url FROM wm_config WHERE key='links.aulas_playlist';",
        "options": {}
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "06382fbc-8557-4369-afd7-1747c4c764ec",
      "name": "Merge Aulas",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        0
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const up=$('Parse Input').item.json;\nreturn { json:{ ...up, text: $json.url } };"
      }
    },
    {
      "id": "c94f5ed8-a862-49ca-9f22-a1bf54b92eab",
      "name": "HTTP Send Aulas Link",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1100,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "https://apiv3.ihelpchat.com/api/v2/customers/send-message",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<redacted-credential>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={{ JSON.stringify({ canalId: '698f6ac2474ca125a518be8d', contato: $json.tel, messageType: 0, texto: $json.text }) }}",
        "options": {
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 2000
            }
          }
        }
      }
    },
    {
      "id": "fe713758-e824-41ef-8f5d-23c4b8ed488f",
      "name": "Get Tally Base",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        660,
        200
      ],
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT value#>>'{}' AS base FROM wm_config WHERE key='links.tally_base';",
        "options": {}
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "be1db05b-c811-45ca-bedd-5c97972db52d",
      "name": "Merge Tally",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        200
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const up=$('Parse Input').item.json;\nconst url = $json.base + '?telefone=' + encodeURIComponent(up.tel);\nreturn { json:{ ...up, text: url } };"
      }
    },
    {
      "id": "365b87af-21b5-42cf-8994-1fa3dcfbd271",
      "name": "HTTP Send Tally Link",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1100,
        200
      ],
      "parameters": {
        "method": "POST",
        "url": "https://apiv3.ihelpchat.com/api/v2/customers/send-message",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<redacted-credential>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={{ JSON.stringify({ canalId: '698f6ac2474ca125a518be8d', contato: $json.tel, messageType: 0, texto: $json.text }) }}",
        "options": {
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 2000
            }
          }
        }
      }
    },
    {
      "id": "19a56919-7087-4253-bd66-16483f6bf8cb",
      "name": "HTTP Move Stage",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        400
      ],
      "parameters": {
        "method": "POST",
        "url": "https://apiv3.ihelpchat.com/api/v2/crm/card/move-by-phone",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<redacted-credential>"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "options": {},
        "rawContentType": "application/json",
        "body": "={{ JSON.stringify({ phoneNumber: $json.tel, stageId: $json.params.stage_id }) }}"
      }
    },
    {
      "id": "60c2dfa8-e99a-4f81-8ddf-c0091a15c49b",
      "name": "HTTP Apply Tags",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        600
      ],
      "parameters": {
        "method": "PUT",
        "url": "https://apiv3.ihelpchat.com/api/v2/customers/etiqueta",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<redacted-credential>"
            }
          ]
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "tags",
              "value": "={{ ($json.params.tags||[]).join('|') }}"
            }
          ]
        },
        "options": {}
      },
      "disabled": true
    },
    {
      "id": "c83720c3-8ed1-4308-bb11-d1b35f39cfc9",
      "name": "Respond OK",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1400,
        100
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return { json:{ ok:true, kind: $('Parse Input').item.json.kind, tel: $('Parse Input').item.json.tel } };"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Parse Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Input": {
      "main": [
        [
          {
            "node": "Switch Kind",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Kind": {
      "main": [
        [
          {
            "node": "Prep Text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Lookup Audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Aulas URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Tally Base",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Move Stage",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Apply Tags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prep Text": {
      "main": [
        [
          {
            "node": "HTTP Send Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Send Text": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lookup Audio": {
      "main": [
        [
          {
            "node": "Merge Audio Id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Audio Id": {
      "main": [
        [
          {
            "node": "HTTP Send Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Send Audio": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Aulas URL": {
      "main": [
        [
          {
            "node": "Merge Aulas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Aulas": {
      "main": [
        [
          {
            "node": "HTTP Send Aulas Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Send Aulas Link": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Tally Base": {
      "main": [
        [
          {
            "node": "Merge Tally",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Tally": {
      "main": [
        [
          {
            "node": "HTTP Send Tally Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Send Tally Link": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Move Stage": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Apply Tags": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Wm-Stage-Actions.N8N-Import. Uses httpRequest, postgres. Webhook trigger; 17 nodes.

Source: https://gist.github.com/bruunofco/a5c92b19abbea6664720dad3a7a5d75b — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

Scraping. Uses httpRequest, postgres, @apify/n8n-nodes-apify, respondToWebhook. Webhook trigger; 61 nodes.

HTTP Request, Postgres, @Apify/N8N Nodes Apify
Data & Sheets

Workflow B — AI Listing Engine. Uses httpRequest, postgres, errorTrigger. Webhook trigger; 47 nodes.

HTTP Request, Postgres, Error Trigger
Data & Sheets

LogSentinel Workflow. Uses postgres, emailSend, httpRequest. Webhook trigger; 44 nodes.

Postgres, Email Send, HTTP Request
Data & Sheets

Pawa VAPI Tools v2 (live-schema). Uses postgres, httpRequest. Webhook trigger; 36 nodes.

Postgres, HTTP Request
Data & Sheets

Fluxo de voluntárias ZendeskXANXBD. Uses functionItem, zendesk, httpRequest, postgres. Webhook trigger; 25 nodes.

Function Item, Zendesk, HTTP Request +1