{
  "name": "conexao_base",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "teste",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -656,
        144
      ],
      "id": "d69c3966-01e1-4da4-8479-7d6e99f39e55",
      "name": "Webhook",
      "webhookId": "dd557d95-02d9-452a-806f-b2168fcbf347"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.covercut.com.br/api/v1/messages/send",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "SEU_BSP"
            },
            {
              "name": "X-API-Secret",
              "value": "SEU_X-API"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"to\": \"NÚMERO_QUE_RECEBE_MENSAGEM\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"Mensagem que o cliente recebe\"\n  }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        320,
        160
      ],
      "id": "aea6b06a-9a56-4277-a198-29e95aa0f497",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "action": "hmac",
        "type": "SHA256",
        "value": "={{ JSON.stringify($json.body) }}",
        "secret": "=WEBHOOK_SECRET"
      },
      "type": "n8n-nodes-base.crypto",
      "typeVersion": 1,
      "position": [
        -448,
        144
      ],
      "id": "3fa456e3-83e9-4424-8da0-f54f7e3def88",
      "name": "Crypto"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c0ad97e2-8f80-44e1-aa00-8bcec2dd4324",
              "leftValue": "={{ $json.headers[\"x-bsp-signature\"] }}",
              "rightValue": "SEU_X-BSP-SIGNATURE",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        -272,
        144
      ],
      "id": "51b911e8-b7b9-4e93-aa3e-91837b5567ee",
      "name": "Filter1"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "75c0f06a-362c-41d7-9c66-4c07c5b2f5e1",
              "leftValue": "={{ $json.body.status.status }}",
              "rightValue": "read",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "6f1a5892-96db-4b50-9a5b-f3e6723b763e",
              "leftValue": "={{ $json.body.status.status }}",
              "rightValue": "sent",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "81fd42b5-4fb7-47a4-a8b1-d7fda885df66",
              "leftValue": "={{ $json.body.status.status }}",
              "rightValue": "delivered",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "b6260fc4-70b2-4ad3-a213-8f6ded66fb44",
              "leftValue": "={{ $json.body.status.status }}",
              "rightValue": "failed",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -48,
        144
      ],
      "id": "44d41a6a-9252-4db3-a859-2fa2e8acc006",
      "name": "If"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "75c0f06a-362c-41d7-9c66-4c07c5b2f5e1",
              "leftValue": "={{ $json.body.status.status }}",
              "rightValue": "failed",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -48,
        -16
      ],
      "id": "367eaf66-854e-408f-b9d9-26cc3e5c17ad",
      "name": "If1"
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "Filter1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter1": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          },
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "40b1b92c-0bbd-4805-b7fe-93bd7641daf9",
  "meta": {
    "instanceId": "2e2beb0c50f80badfc31d63ee3a66582c6e22a184f188d13020e28fb161c368e"
  },
  "id": "mM8vAtUZh7smQEac",
  "tags": []
}