{
  "name": "SinoDossier — Global Multilingual UGC Matrix & beehiiv Retention",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": 0,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "1. Receive Winning Product Brief"
        }
      }
    },
    {
      "id": 2,
      "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 global-ugc-localization Skill. Transcreate the product into US, ES, and DE 35s UGC scripts plus a beehiiv email draft. Return strict JSON with keys: product_name, us_script, es_script, de_script, beehiiv_subject, beehiiv_preview.\"},{\"role\":\"user\",\"content\":\"Product: {{1.product_name}} | Points: {{1.selling_points}}\"}]}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "2. Run Multilingual UGC Localization Skill"
        }
      }
    },
    {
      "id": 3,
      "module": "json:ParseJSON",
      "version": 1,
      "parameters": {
        "type": ""
      },
      "mapper": {
        "json": "{{2.data.choices[1].message.content}}"
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "3. Parse Localized Scripts & Email JSON"
        }
      }
    },
    {
      "id": 4,
      "module": "builtin:BasicRouter",
      "version": 1,
      "mapper": null,
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0,
          "name": "4. Fan-Out to Voice, Video & Email"
        }
      },
      "routes": [
        {
          "flow": [
            {
              "id": 5,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {
                "handleErrors": true,
                "useNewZLibDeCompress": true
              },
              "mapper": {
                "url": "https://api.elevenlabs.io/v1/text-to-speech/YOUR_ELEVENLABS_VOICE_ID",
                "method": "post",
                "headers": [
                  {
                    "name": "xi-api-key",
                    "value": "YOUR_ELEVENLABS_API_KEY"
                  },
                  {
                    "name": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "bodyType": "raw",
                "parseResponse": false,
                "contentType": "application/json",
                "data": "{\"text\":\"{{3.us_script}}\",\"model_id\":\"eleven_multilingual_v2\"}"
              },
              "metadata": {
                "designer": {
                  "x": 1220,
                  "y": -140,
                  "name": "5A. Generate ElevenLabs Voiceover"
                }
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 6,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {
                "handleErrors": true,
                "useNewZLibDeCompress": true
              },
              "mapper": {
                "url": "https://api.heygen.com/v2/video_translate",
                "method": "post",
                "headers": [
                  {
                    "name": "X-Api-Key",
                    "value": "YOUR_HEYGEN_API_KEY"
                  },
                  {
                    "name": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "bodyType": "raw",
                "parseResponse": true,
                "contentType": "application/json",
                "data": "{\"video_url\":\"{{1.source_video_url}}\",\"output_language\":\"Spanish\",\"title\":\"{{3.product_name}} - ES\"}"
              },
              "metadata": {
                "designer": {
                  "x": 1220,
                  "y": 0,
                  "name": "5B. Queue HeyGen Lip-Sync Dub"
                }
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 7,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {
                "handleErrors": true,
                "useNewZLibDeCompress": true
              },
              "mapper": {
                "url": "https://api.beehiiv.com/v2/publications/YOUR_BEEHIIV_PUB_ID/posts",
                "method": "post",
                "headers": [
                  {
                    "name": "Authorization",
                    "value": "Bearer YOUR_BEEHIIV_API_KEY"
                  },
                  {
                    "name": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "bodyType": "raw",
                "parseResponse": true,
                "contentType": "application/json",
                "data": "{\"title\":\"{{3.beehiiv_subject}}\",\"subtitle\":\"{{3.beehiiv_preview}}\",\"status\":\"draft\"}"
              },
              "metadata": {
                "designer": {
                  "x": 1220,
                  "y": 140,
                  "name": "5C. Create beehiiv Newsletter Draft"
                }
              }
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false
    },
    "designer": {
      "orphans": []
    }
  }
}
