{
  "name": "LinkedScope – Conexão com qualquer CRM",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": null,
        "maxResults": 1
      },
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "LinkedScope chama este webhook"
        }
      }
    },
    {
      "id": 2,
      "module": "http:MakeRequest",
      "version": 4,
      "parameters": {
        "authenticationType": "noAuth",
        "tlsType": "",
        "proxyKeychain": ""
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "Buscar negócios no CRM (substitua)"
        }
      },
      "mapper": {
        "url": "https://api.seu-crm.com/v1/deals",
        "method": "get",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer SEU_TOKEN_DO_CRM"
          }
        ],
        "parseResponse": true,
        "stopOnHttpError": true,
        "allowRedirects": true,
        "shareCookies": false,
        "requestCompressedContent": true,
        "paginationType": "",
        "paginationOutputFormat": "pages",
        "limit": 10000
      }
    },
    {
      "id": 3,
      "module": "builtin:BasicAggregator",
      "version": 1,
      "parameters": {
        "feeder": 2
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "Juntar páginas do CRM"
        }
      },
      "mapper": {
        "data": "{{2.data}}"
      }
    },
    {
      "id": 4,
      "module": "json:TransformToJSON",
      "version": 1,
      "parameters": {
        "space": ""
      },
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0,
          "name": "Converter para JSON"
        }
      },
      "mapper": {
        "object": "{{3.array}}"
      }
    },
    {
      "id": 5,
      "module": "gateway:WebhookRespond",
      "version": 1,
      "parameters": {},
      "metadata": {
        "designer": {
          "x": 1200,
          "y": 0,
          "name": "Responder ao LinkedScope (mapa de campos)"
        }
      },
      "mapper": {
        "status": 200,
        "body": "{\n  \"fieldMap\": {\n    \"dealId\": \"id\",\n    \"dealName\": \"title\",\n    \"companyName\": \"company_name\",\n    \"companyDomain\": \"company_domain\",\n    \"linkedinCompanyUrl\": \"linkedin_company_url\",\n    \"dealStage\": \"stage\",\n    \"status\": \"status\",\n    \"dealValue\": \"value\",\n    \"createdAt\": \"created_at\",\n    \"closedAt\": \"closed_at\",\n    \"ownerName\": \"owner_name\",\n    \"ownerEmail\": \"owner_email\",\n    \"pipeline\": \"pipeline\",\n    \"dealLink\": \"url\"\n  },\n  \"deals\": {{4.json}}\n}",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ]
      }
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    }
  }
}
