{
  "name": "ZapZap: send a WhatsApp message when a form is submitted",
  "nodes": [
    {
      "parameters": {
        "content": "POST {\"name\":\"Ana\",\"phone\":\"5511999999999\"} to this workflow's webhook URL (your form tool or curl). The lead gets a confirmation on WhatsApp. Only message people who asked to hear from you. Open the Config node and fill instanceId, apiKey and apiSecret (dashboard: Settings and API). ",
        "width": 460,
        "height": 250
      },
      "id": "n1",
      "name": "Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -260,
        -140
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "zapzap-form",
        "options": {}
      },
      "id": "n2",
      "name": "Form webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        100
      ],
      "webhookId": "zapzap-form"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "n3",
              "name": "baseUrl",
              "value": "https://api.zapzapapi.com/api/v1",
              "type": "string"
            },
            {
              "id": "n4",
              "name": "instanceId",
              "value": "YOUR_INSTANCE_ID",
              "type": "string"
            },
            {
              "id": "n5",
              "name": "apiKey",
              "value": "YOUR_API_KEY",
              "type": "string"
            },
            {
              "id": "n6",
              "name": "apiSecret",
              "value": "YOUR_API_SECRET",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "id": "n7",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        100
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $(\"Config\").first().json.baseUrl }}/{{ $(\"Config\").first().json.instanceId }}/send/text",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $(\"Config\").first().json.apiKey }}"
            },
            {
              "name": "x-api-secret",
              "value": "={{ $(\"Config\").first().json.apiSecret }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ number: String($json.body.phone).replace(/\\D/g, ''), text: 'Hi ' + $json.body.name + '! We got your request and will contact you soon.' }) }}",
        "options": {}
      },
      "id": "n8",
      "name": "Send confirmation",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        100
      ]
    }
  ],
  "connections": {
    "Form webhook": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Send confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
