{
  "name": "Mawidi Test Webhook",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "mawidi-test",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [250, 300],
      "webhookId": "mawidi-test-webhook"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{$env.MAWIDI_API_URL}}/api/webhooks/n8n/conversation",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"auth_token\": \"{{$env.MAWIDI_WEBHOOK_TOKEN}}\",\n  \"user_id\": \"{{$json.body.user_id}}\",\n  \"platform\": \"whatsapp\",\n  \"customer_phone\": \"{{$json.body.customer_phone}}\",\n  \"customer_name\": \"{{$json.body.customer_name}}\",\n  \"message\": {\n    \"role\": \"{{$json.body.message_role}}\",\n    \"content\": \"{{$json.body.message_content}}\",\n    \"timestamp\": \"{{$now.toISO()}}\"\n  }\n}",
        "options": {}
      },
      "id": "http-request",
      "name": "Send to Mawidi",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [500, 300]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { success: true, message: \"Webhook processed\", mawidi_response: $json } }}",
        "options": {}
      },
      "id": "respond-webhook",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [750, 300]
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Send to Mawidi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Mawidi": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "mawidi-instance"
  },
  "pinData": {},
  "versionId": "1",
  "triggerCount": 0,
  "tags": [
    {
      "name": "mawidi",
      "id": "mawidi-tag"
    }
  ]
}
