{
  "name": "FlowPantry - ai-lead-qualifier",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": null,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        }
      }
    },
    {
      "id": 2,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {},
      "mapper": {
        "url": "https://api.openai.com/v1/chat/completions",
        "method": "post",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer YOUR_OPENAI_API_KEY"
          }
        ],
        "qs": [],
        "serializeUrl": false,
        "parseResponse": true,
        "shareCookies": false,
        "rejectUnauthorized": true,
        "followRedirect": true,
        "useQuerystring": false,
        "gzip": true,
        "useMtls": false,
        "timeout": "",
        "bodyType": "raw",
        "contentType": "application/json",
        "inputMethod": "jsonString",
        "data": "{\"model\": \"gpt-4o-mini\", \"messages\": [{\"role\": \"user\", \"content\": \"Score this lead 1-10 for fit with: IDEAL_CUSTOMER. Respond ONLY JSON {\\\"score\\\":n,\\\"reason\\\":\\\"...\\\"}. Lead: {{1.name}}, {{1.message}}\"}]}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0
        }
      }
    },
    {
      "id": 3,
      "module": "json:ParseJSON",
      "version": 1,
      "parameters": {
        "type": ""
      },
      "mapper": {
        "json": "{{2.data.choices[].message.content}}"
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        }
      }
    },
    {
      "id": 4,
      "module": "builtin:BasicRouter",
      "version": 1,
      "parameters": {},
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0
        }
      },
      "routes": [
        {
          "flow": [
            {
              "id": 5,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {},
              "mapper": {
                "url": "SLACK_HOT_URL",
                "method": "post",
                "headers": [],
                "qs": [],
                "serializeUrl": false,
                "parseResponse": true,
                "shareCookies": false,
                "rejectUnauthorized": true,
                "followRedirect": true,
                "useQuerystring": false,
                "gzip": true,
                "useMtls": false,
                "timeout": "",
                "bodyType": "raw",
                "contentType": "application/json",
                "inputMethod": "jsonString",
                "data": "{\"text\": \"<!here> HOT lead {{3.score}}/10: {{1.name}} {{1.phone}}: {{3.reason}}\"}"
              },
              "metadata": {
                "designer": {
                  "x": 1200,
                  "y": 0
                }
              },
              "filter": {
                "name": "Hot lead",
                "conditions": [
                  [
                    {
                      "a": "{{3.score}}",
                      "o": "number:greaterorequal",
                      "b": "7"
                    }
                  ]
                ]
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 6,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {},
              "mapper": {
                "url": "SLACK_OTHER_URL",
                "method": "post",
                "headers": [],
                "qs": [],
                "serializeUrl": false,
                "parseResponse": true,
                "shareCookies": false,
                "rejectUnauthorized": true,
                "followRedirect": true,
                "useQuerystring": false,
                "gzip": true,
                "useMtls": false,
                "timeout": "",
                "bodyType": "raw",
                "contentType": "application/json",
                "inputMethod": "jsonString",
                "data": "{\"text\": \"Lead {{3.score}}/10: {{1.name}} {{1.phone}}: {{3.reason}}\"}"
              },
              "metadata": {
                "designer": {
                  "x": 1200,
                  "y": 0
                }
              },
              "filter": {
                "name": "Other leads",
                "conditions": [
                  [
                    {
                      "a": "{{3.score}}",
                      "o": "number:less",
                      "b": "7"
                    }
                  ]
                ]
              }
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "slots": null,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    },
    "zone": "us1.make.com"
  }
}