{
  "name": "SinoDossier — Cross-Border Ops, Review Triage & FX Margin Alert",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": 0,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "1. Receive Review URL or Payout Event"
        }
      }
    },
    {
      "id": 2,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": true,
        "useNewZLibDeCompress": true
      },
      "mapper": {
        "url": "https://api.firecrawl.dev/v1/scrape",
        "method": "post",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer YOUR_FIRECRAWL_API_KEY"
          },
          {
            "name": "Content-Type",
            "value": "application/json"
          }
        ],
        "bodyType": "raw",
        "parseResponse": true,
        "contentType": "application/json",
        "data": "{\"url\":\"{{1.target_url}}\",\"formats\":[\"markdown\"],\"onlyMainContent\":true}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "2. Firecrawl Scrape to Clean Markdown"
        }
      }
    },
    {
      "id": 3,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": true,
        "useNewZLibDeCompress": true
      },
      "mapper": {
        "url": "https://api.openai.com/v1/chat/completions",
        "method": "post",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer YOUR_OPENAI_API_KEY"
          },
          {
            "name": "Content-Type",
            "value": "application/json"
          }
        ],
        "bodyType": "raw",
        "parseResponse": true,
        "contentType": "application/json",
        "data": "{\"model\":\"gpt-4o-mini\",\"response_format\":{\"type\":\"json_object\"},\"messages\":[{\"role\":\"system\",\"content\":\"You are the SinoDossier crossborder-ops-finance-agent Skill. Classify severity (P0|P1|P2), root_cause, language, task_title, assigned_team, customer_reply_draft, and supplier_action_note. Return strict JSON.\"},{\"role\":\"user\",\"content\":\"Analyze: {{2.data.data.markdown}}\"}]}"
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "3. AI Ops & FX Triage Skill"
        }
      }
    },
    {
      "id": 4,
      "module": "json:ParseJSON",
      "version": 1,
      "parameters": {
        "type": ""
      },
      "mapper": {
        "json": "{{3.data.choices[1].message.content}}"
      },
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0,
          "name": "4. Parse Triage Output JSON"
        }
      }
    },
    {
      "id": 5,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": true,
        "useNewZLibDeCompress": true
      },
      "mapper": {
        "url": "https://api.clickup.com/api/v2/list/YOUR_CLICKUP_LIST_ID/task",
        "method": "post",
        "headers": [
          {
            "name": "Authorization",
            "value": "YOUR_CLICKUP_API_TOKEN"
          },
          {
            "name": "Content-Type",
            "value": "application/json"
          }
        ],
        "bodyType": "raw",
        "parseResponse": true,
        "contentType": "application/json",
        "data": "{\"name\":\"{{4.task_title}}\",\"description\":\"Root Cause: {{4.root_cause}}\\nTeam: {{4.assigned_team}}\\n\\nDraft Reply:\\n{{4.customer_reply_draft}}\\n\\nNote:\\n{{4.supplier_action_note}}\",\"priority\":2}"
      },
      "metadata": {
        "designer": {
          "x": 1200,
          "y": 0,
          "name": "5. Create ClickUp Task"
        }
      }
    },
    {
      "id": 6,
      "module": "builtin:BasicRouter",
      "version": 1,
      "mapper": null,
      "metadata": {
        "designer": {
          "x": 1500,
          "y": 0,
          "name": "6. Escalate P0 Alerts"
        }
      },
      "routes": [
        {
          "flow": [
            {
              "id": 7,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {
                "handleErrors": true,
                "useNewZLibDeCompress": true
              },
              "filter": {
                "name": "Priority equals P0",
                "conditions": [
                  [
                    {
                      "a": "{{4.priority}}",
                      "b": "P0",
                      "o": "text:equal"
                    }
                  ]
                ]
              },
              "mapper": {
                "url": "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK",
                "method": "post",
                "headers": [
                  {
                    "name": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "bodyType": "raw",
                "parseResponse": false,
                "contentType": "application/json",
                "data": "{\"text\":\"🚨 P0 Cross-Border Alert: {{4.task_title}} ({{4.root_cause}}) — Draft ready in ClickUp.\"}"
              },
              "metadata": {
                "designer": {
                  "x": 1800,
                  "y": -80,
                  "name": "7. Notify Founder on Slack"
                }
              }
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false
    },
    "designer": {
      "orphans": []
    }
  }
}
