{
  "name": "Agente AI Comentários Instagram",
  "nodes": [
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8caaa2ba-8f28-4e3a-96b5-3be920fc38d9",
              "name": "meuid",
              "value": "={{ $json.body.entry[0].id }}",
              "type": "string"
            },
            {
              "id": "74ed1baf-3f8c-44ef-aee7-3bfd9d40b8f7",
              "name": "senderid",
              "value": "={{ $json.body.entry[0].changes[0].value.from.id }}",
              "type": "string"
            },
            {
              "id": "0164673b-a135-4baf-8394-f2b8c08d02ca",
              "name": "username",
              "value": "={{ $json.body.entry[0].changes[0].value.from.username }}",
              "type": "string"
            },
            {
              "id": "530e5b65-b636-4b55-9e8a-b4fde7753d13",
              "name": "postid",
              "value": "={{ $json.body.entry[0].changes[0].value.media.id }}",
              "type": "string"
            },
            {
              "id": "fc73aea6-bf5a-4d54-8f38-4812c490ddd7",
              "name": "commentid",
              "value": "={{ $json.body.entry[0].changes[0].value.id }}",
              "type": "string"
            },
            {
              "id": "74f05353-0e70-4ec1-a4dc-6ef0be523aae",
              "name": "commenttext",
              "value": "={{ $json.body.entry[0].changes[0].value.text }}",
              "type": "string"
            },
            {
              "id": "1cf7c39b-6f73-4b51-b2ef-d0539ffc0ebb",
              "name": "field",
              "value": "={{ $json.body.entry[0].changes[0].field }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        620,
        860
      ],
      "id": "bffc58c9-1f66-4d37-bf0b-81a91022eae7",
      "name": "Manipular Dados"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c9358a34-8dfc-43c8-a591-7b7f210b5918",
              "leftValue": "={{ $json.senderid }}",
              "rightValue": "={{ $json.meuid }}",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            },
            {
              "id": "dac26075-d049-411c-b45e-84cf7fc20ad4",
              "leftValue": "={{ $json.field }}",
              "rightValue": "comments",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        800,
        860
      ],
      "id": "eff54c5b-ef9c-4b95-9abf-77baf2611e62",
      "name": "Filtro de Mensagem"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://graph.instagram.com/v21.0/{{ $json.commentid }}/replies",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer "
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "message",
              "value": "=Obrigado"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1000,
        860
      ],
      "id": "d5781de3-99c0-413e-a882-27be55e2f157",
      "name": "Responder Comentário"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "comentario-instagram",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        440,
        860
      ],
      "id": "0ba5783d-bf71-4564-bba2-972e62c7458f",
      "name": "Webhook Post",
      "webhookId": "dd06c831-b6f2-4821-9b4f-8f5ba168e5ab"
    }
  ],
  "pinData": {
    "Webhook Post": [
      {
        "json": {
          "headers": {
            "host": "mywebhook.mywebagencia.com.br",
            "user-agent": "Webhooks/1.0 (https://fb.me/webhooks)",
            "content-length": "313",
            "accept": "*/*",
            "content-type": "application/json",
            "x-forwarded-for": "31.13.115.5",
            "x-forwarded-host": "mywebhook.mywebagencia.com.br",
            "x-forwarded-port": "443",
            "x-forwarded-proto": "https",
            "x-forwarded-server": "0b8c87f7af73",
            "x-hub-signature": "sha1=ff648e84e02768ca286d57fa2f0898978cb46f62",
            "x-hub-signature-256": "sha256=a560f0f416bba7b135c1f84fe5fabbbb4d3cd9c81f924d7604b87756a410439d",
            "x-real-ip": "31.13.115.5",
            "accept-encoding": "gzip"
          },
          "params": {},
          "query": {},
          "body": {
            "entry": [
              {
                "id": "17841445787622448",
                "time": 1732306167,
                "changes": [
                  {
                    "value": {
                      "from": {
                        "id": "6395444230476471",
                        "username": "lucianogoncalvesmkt"
                      },
                      "media": {
                        "id": "17902888163759546",
                        "media_product_type": "FEED"
                      },
                      "id": "18482034898032515",
                      "text": "Legal"
                    },
                    "field": "comments"
                  }
                ]
              }
            ],
            "object": "instagram"
          },
          "webhookUrl": "https://mywebhook.mywebagencia.com.br/webhook/comentario-instagram",
          "executionMode": "production"
        }
      }
    ]
  },
  "connections": {
    "Manipular Dados": {
      "main": [
        [
          {
            "node": "Filtro de Mensagem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filtro de Mensagem": {
      "main": [
        [
          {
            "node": "Responder Comentário",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Post": {
      "main": [
        [
          {
            "node": "Manipular Dados",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3155f8fb-0391-4751-8315-7b73050fbf83",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "442495cea8a57bd70857f3db797d80d9e6ac88a3eb23a4f48f1d184aca572e09"
  },
  "id": "ivahgdbLjOa3wyD0",
  "tags": []
}