{
  "name": "Pedido Aceito via WhatsApp",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "pedido-aceito",
        "responseMode": "lastNode",
        "options": {
          "responseData": {
            "type": "json"
          }
        }
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        240,
        240
      ]
    },
    {
      "parameters": {
        "rules": [
          {
            "value1": "={{$json[\"status\"]}}",
            "operation": "equal",
            "value2": "accepted"
          }
        ]
      },
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 1,
      "position": [
        450,
        240
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "={{$env.WHATSAPP_API_URL}}",
        "jsonParameters": true,
        "bodyParametersJson": "={\n  \"to\": \"{{$json[\\\"whatsapp\\\"]}}\",\n  \"message\": \"Ol\u00e1 {{$json[\\\"customer_name\\\"]}}, seu pedido {{$json[\\\"table_number\\\"] ? 'da mesa ' + $json[\\\"table_number\\\"] : 'de delivery'}} foi aceito e j\u00e1 est\u00e1 em produ\u00e7\u00e3o!\"\n}"
      },
      "name": "WhatsApp",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        660,
        240
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "WhatsApp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}