Hey everyone, I’m trying to kick off an Architect flow programmatically from an external Node.js service using the POST /api/v2/flows/executions endpoint. The goal is to trigger a specific flow based on a webhook payload, but I keep hitting a 400 Bad Request wall. I’ve double-checked the OAuth token generation-it’s valid and has the admin scope. The issue seems to be with the request body structure. I’m passing the flow ID in the URL path as documented, but the body requires a type and a configuration object. Here’s the snippet I’m using:
const response = await fetch(`https://myinstance.mypurecloud.com/api/v2/flows/executions/${FLOW_ID}`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'flow',
configuration: {
flowId: FLOW_ID,
parameters: {
'contactId': contactId,
'source': 'webhook'
}
}
})
});
The error response is just {"message":"Invalid request body"}. It’s not telling me what is invalid. I’ve tried removing the configuration block and just sending the parameters, but that fails too. I’ve also verified the flow ID exists and is active in the UI.
I’m suspecting the type field might be wrong, or maybe the parameters need to be wrapped differently. The docs are pretty thin on this specific endpoint. Has anyone successfully triggered a flow this way recently? I’ve been staring at this for two hours and it’s driving me nuts. The flow works fine when triggered manually in Architect, so it’s not a flow config issue. Just the API call itself. I’m using the latest version of the Genesys Cloud Platform API docs, but maybe I’m missing a subtle requirement in the JSON schema. Any pointers would be awesome.