[
    {
        "id": "42a697419f3f3af2",
        "type": "conversation-controller-init",
        "z": "25255a8572cbdb40",
        "name": "Conversation Ended",
        "url": "/intent",
        "method": "post",
        "upload": false,
        "intents": [
            {
                "value": "CONVERSATION_ENDED",
                "label": "Conversation Ended"
            }
        ],
        "outputs": 1,
        "permissionsRequired": [
            "init-controller-node"
        ],
        "x": 147.39999389648438,
        "y": 2288.000015258789,
        "wires": [
            [
                "8fbf51faecbb6b6b"
            ]
        ]
    },
    {
        "id": "8fbf51faecbb6b6b",
        "type": "function",
        "z": "25255a8572cbdb40",
        "name": "Survey Init Payload",
        "func": "const data = msg.payload;\nconst conversationId = data.conversation?.id;\nconst customer = data.conversation?.customer;\nconst serviceIdentifier =\n    data.conversation?.channelSession?.channel?.serviceIdentifier;\n\nif (!conversationId || !customer?._id || !serviceIdentifier) {\n    node.error(\n        `Missing survey trigger data: conversationId=${conversationId}, ` +\n        `customerId=${customer?._id}, serviceIdentifier=${serviceIdentifier}`,\n        data\n    );\n    return null;\n}\n\ndata.method = \"POST\";\nconst base = \"http://mtt02-campaign-studio-svc.mtt02.svc.cluster.local:1880\";\ndata.url = `${base}/red/survey-trigger`;\n\ndata.payload = {\n    id: conversationId,\n    customer: customer,\n    channelSession: {\n        channel: {\n            serviceIdentifier: serviceIdentifier\n        }\n    }\n};\n\ndata.headers = {\n    \"Content-Type\": \"application/json\"\n};\n\nreturn data;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 398.39998626708984,
        "y": 2287.999912261963,
        "wires": [
            [
                "f89dfdbf0e141ba4"
            ]
        ]
    },
    {
        "id": "f89dfdbf0e141ba4",
        "type": "custom http request",
        "z": "25255a8572cbdb40",
        "name": "Call Survey Init",
        "method": "use",
        "ret": "txt",
        "paytoqs": "ignore",
        "requestbody": "payload",
        "response": "response",
        "responseType": "msg",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "permissionsRequired": [
            "custom-http-request-controller-node"
        ],
        "x": 628.4000473022461,
        "y": 2288.600009918213,
        "wires": [
            []
        ]
    },
    {
        "id": "786ef0097ddc6e1e",
        "type": "global-config",
        "env": [],
        "modules": {
            "conversation-studio": "1.0.0"
        }
    }
]