{
  "name": "WhatSync group Received starter",
  "active": false,
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "whatsync-group",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "trigger",
      "name": "WhatsApp event",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "whatsync-group"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.body.type }}",
              "rightValue": "message.received",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "leftValue": "={{ $json.body.data.message.group?.id }}",
              "rightValue": "YOUR_GROUP_JID",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "leftValue": "={{ $json.body.data.message.from_me }}",
              "rightValue": false,
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "filter",
      "name": "Only the selected group",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://whatsync.app/api/v1/tools/send_group_message",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "={{ $json.body.id }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { jid: $json.body.data.message.group.id, text: \"Received\" } }}",
        "options": {}
      },
      "id": "reply",
      "name": "Reply Received",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        0
      ]
    },
    {
      "parameters": {
        "fromEmail": "sender@example.invalid",
        "toEmail": "person1@example.invalid, person2@example.invalid, person3@example.invalid",
        "subject": "WhatsApp group message",
        "emailFormat": "text",
        "text": "={{ $(\"WhatsApp event\").item.json.body.data.message.text }}",
        "options": {
          "appendAttribution": false
        }
      },
      "id": "email",
      "name": "Email three people (configure first)",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "disabled": true,
      "position": [
        720,
        0
      ]
    },
    {
      "parameters": {
        "content": "Before activating: set YOUR_GROUP_JID, select Header Auth (Authorization: Bearer your API key), verify webhook signatures on raw bytes, and persist event-ID deduplication. Configure SMTP, the sender and the three recipients on the disabled email node, then enable it. No credentials or real recipients are included.",
        "height": 240,
        "width": 640
      },
      "id": "setup",
      "name": "Setup required",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -300
      ]
    }
  ],
  "connections": {
    "WhatsApp event": {
      "main": [
        [
          {
            "node": "Only the selected group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only the selected group": {
      "main": [
        [
          {
            "node": "Reply Received",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Reply Received": {
      "main": [
        [
          {
            "node": "Email three people (configure first)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
