AutomationFlowsGeneral › Waha - Message Type Extractor V2

Waha - Message Type Extractor V2

WAHA - Message Type Extractor v2. Webhook trigger; 12 nodes.

Webhook trigger★★★★☆ complexity12 nodes
General Trigger: Webhook Nodes: 12 Complexity: ★★★★☆ Added:

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
{
  "name": "WAHA - Message Type Extractor v2",
  "nodes": [
    {
      "id": "webhook_entrada",
      "type": "n8n-nodes-base.webhook",
      "name": "Webhook - WAHA",
      "typeVersion": 1,
      "position": [
        280,
        320
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "webhook/waha",
        "responseMode": "onReceived",
        "responseData": "auto"
      }
    },
    {
      "id": "function_extract",
      "type": "n8n-nodes-base.function",
      "name": "Extrair Dados WAHA",
      "typeVersion": 1,
      "position": [
        700,
        320
      ],
      "parameters": {
        "functionCode": "const body = $json.body || {};\nconst p = body.payload || {};\n\n// Campos principais\nconst instance = body.session || null;\nconst eventId = body.id || null;\nconst messageId = p.id || null;\nconst messageType = p.messageType || p._data?.Info?.Type || \"unknown\";\n\n// Conte\u00fados\nconst text = p.body || p._data?.Message?.conversation || null;\nconst media = p.media || null;\n\n// remoteJid\nconst remoteJid = p._data?.Info?.Chat || p.from || p.to || null;\n\n// telefone e nome\nconst from = p.from?.replace(\"@c.us\", \"\") || null;\nconst name = p._data?.Info?.PushName || null;\n\n// grupo e participantes\nconst isGroup = p._data?.Info?.IsGroup || false;\nconst participant = p.participant || null;\n\n// veio de mim\nconst fromMe = p.fromMe || false;\n\nreturn [\n{\n  json: {\n    instance,\n    eventId,\n    messageId,\n    remoteJid,\n    messageType,\n    text,\n    media,\n    from,\n    name,\n    participant,\n    isGroup,\n    fromMe,\n    full: $json\n  }\n}\n];"
      }
    },
    {
      "id": "switch_tipo",
      "type": "n8n-nodes-base.switch",
      "name": "Switch Tipo",
      "typeVersion": 1,
      "position": [
        1040,
        320
      ],
      "parameters": {
        "value1": "={{$json[\"messageType\"]}}",
        "rules": {
          "rules": [
            {
              "operation": "equals",
              "value": "text"
            },
            {
              "operation": "equals",
              "value": "image"
            },
            {
              "operation": "equals",
              "value": "audio"
            },
            {
              "operation": "equals",
              "value": "video"
            },
            {
              "operation": "equals",
              "value": "document"
            },
            {
              "operation": "equals",
              "value": "sticker"
            },
            {
              "operation": "equals",
              "value": "location"
            },
            {
              "operation": "equals",
              "value": "button"
            },
            {
              "operation": "equals",
              "value": "list"
            }
          ]
        }
      }
    },
    {
      "id": "texto",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83d\udcc4 Texto",
      "typeVersion": 1,
      "position": [
        1400,
        40
      ]
    },
    {
      "id": "imagem",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83d\uddbc\ufe0f Imagem",
      "typeVersion": 1,
      "position": [
        1400,
        160
      ]
    },
    {
      "id": "audio",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83c\udfa7 \u00c1udio",
      "typeVersion": 1,
      "position": [
        1400,
        280
      ]
    },
    {
      "id": "video",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83c\udfac V\u00eddeo",
      "typeVersion": 1,
      "position": [
        1400,
        400
      ]
    },
    {
      "id": "documento",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83d\udcc4 Documento",
      "typeVersion": 1,
      "position": [
        1400,
        520
      ]
    },
    {
      "id": "sticker",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83d\udc9f Sticker",
      "typeVersion": 1,
      "position": [
        1400,
        640
      ]
    },
    {
      "id": "location",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83d\udccd Localiza\u00e7\u00e3o",
      "typeVersion": 1,
      "position": [
        1400,
        760
      ]
    },
    {
      "id": "button",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83d\udd18 Bot\u00e3o",
      "typeVersion": 1,
      "position": [
        1400,
        880
      ]
    },
    {
      "id": "list",
      "type": "n8n-nodes-base.noOp",
      "name": "\ud83d\udccb Lista",
      "typeVersion": 1,
      "position": [
        1400,
        1000
      ]
    }
  ],
  "connections": {
    "webhook_entrada": {
      "main": [
        [
          {
            "node": "function_extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "function_extract": {
      "main": [
        [
          {
            "node": "switch_tipo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "switch_tipo": {
      "main": [
        [
          {
            "node": "\ud83d\udcc4 Texto",
            "type": "main",
            "index": 0
          },
          {
            "node": "\ud83d\uddbc\ufe0f Imagem",
            "type": "main",
            "index": 1
          },
          {
            "node": "\ud83c\udfa7 \u00c1udio",
            "type": "main",
            "index": 2
          },
          {
            "node": "\ud83c\udfac V\u00eddeo",
            "type": "main",
            "index": 3
          },
          {
            "node": "\ud83d\udcc4 Documento",
            "type": "main",
            "index": 4
          },
          {
            "node": "\ud83d\udc9f Sticker",
            "type": "main",
            "index": 5
          },
          {
            "node": "\ud83d\udccd Localiza\u00e7\u00e3o",
            "type": "main",
            "index": 6
          },
          {
            "node": "\ud83d\udd18 Bot\u00e3o",
            "type": "main",
            "index": 7
          },
          {
            "node": "\ud83d\udccb Lista",
            "type": "main",
            "index": 8
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

WAHA - Message Type Extractor v2. Webhook trigger; 12 nodes.

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

More General workflows → · Browse all categories →

Related workflows

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

General

A production-ready authentication workflow implementing secure user registration, login, token verification, and refresh token mechanisms. Perfect for adding authentication to any application without

Crypto, Data Table, Execute Workflow Trigger
General

Portfolio Orchestrator. Uses httpRequest. Webhook trigger; 59 nodes.

HTTP Request
General

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.

General

github code Try yourself

Google Calendar
General

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

N8N Nodes 1Shot