SimonBrown | 2023-03-13 18:55:50 UTC | #1
Trying to understand api/v2/flows/execution to pass parameters to a workflow, and then access those parameters in the workflow. I would normally just work through this but the complete lack of logging or debugging options with workflows is making this difficult and a time sink.
The "wizard" in the api explorer generates an outer array and I can define parameters in 2 basic formats;
{ "flowId": "ec866884-2c19-41cf-a04f-bd602102f956", "name": "Work Flow test passing parameters", "inputData": { "Param1": { "Param1": "Parameter1" }, "Param2": { "Param2": "Parameter2" }, "Param3": { "Param3": "Parameter3" } } }
or a single nested array;
{ "flowId": "ec866884-2c19-41cf-a04f-bd602102f956", "name": "Work Flow test passing parameters", "inputData": { "Parameters": { "Param1": "Parameter1Value", "Param2": "Parameter2Value" } } }
how can I receive/define these parameters in the workflow Data input parameters?
I have tried a json object for InputData, string object with parsing. However, the json functions are quite new and not used them yet, along with the lack of knowing if the workflow has even allocated the inputData object into the workflow data var. I don't even know if I am getting the data.
I see the api/v2/flows/executions/{flowExecutionId} shows an inputSchema which looks like the Input variables I have defined in the workflow, but I can't see how to match to the execution endpoint definition of "inputData" (in my example)
I can also see errors in the output, but that is me trying to assign vars later in the workflow so will need to get the schemas sorted first.
Unless I have missed something the lack of any logging or debugging workflows makes this type of activity painful. Trying something, then executing again and looking at the execution result endpoint could take a life time!.
The flow is not linked to an interaction so I can't even attempt to use participant data as a workaround logger.
Jerome.Saint-Marc | 2023-03-14 08:58:14 UTC | #2
Hello,
The format for your input parameters in the inputData should be like this:
{ "flowId": "ec866884-2c19-41cf-a04f-bd602102f956", "name": "Work Flow test passing parameters", "inputData": { "Parameters": { "Flow.MyFirstInput": "tra la la", "Flow.MySecondInput": "tsouin tsouin" } } }
With "Flow.MyFirstInput" and "Flow.MySecondInput" being defined in your workflow as input variables (i.e. flow level variable with "Input to flow" selected under Variable options).
Similar thing is done in the outputData (querying flow execution - when status is COMPLETED). This will contain the output variables you have defined in your workflow (flow level variable - Flow.MyFirstOutput - "Output from flow" selected under Variable options).
Regards,
SimonBrown | 2023-03-14 13:00:13 UTC | #3
merci beaucoup
That worked. It was the "Flow." piece that was not obvious.
Would be useful on api explorer to have some documentation on syntax of parameters for others :grinning:
Merci encore pour votre aide
/edit I was too keen. The Input parameters are not coming through, none of them reached my API. I wrapped with isNotSetOrEmpty method and all are coming back with the empty.
SimonBrown | 2023-03-14 13:09:28 UTC | #4
With images to check... Post attempt (using API Explored for PoC)
Flow does execute, I see payload arriving at my API and the Genesys execution api response shows as such;
The flow data looks like;
and my usage of them;
re-using another test API for output hence dummy data in conversationId and queueId.
If(IsNotSetOrEmpty(State.Param2AsInt),0,State.Param2AsInt) If(IsNotSetOrEmpty(State.Parameter1),"",State.Parameter1) If(IsNotSetOrEmpty(State.Param3AsBoolean),false,State.Param3AsBoolean)
See anything obvious?
Jerome.Saint-Marc | 2023-03-15 11:07:43 UTC | #5
Sorry - my mistake. I used one of your post as start point and didn't pay attention enough and left the Parameters structure...
This should be:
{ "flowId": "ec866884-2c19-41cf-a04f-bd602102f956", "name": "Work Flow test passing parameters", "inputData": { "Flow.MyFirstInput": "tra la la", "Flow.MySecondInput": "tsouin tsouin" } }
SimonBrown | 2023-03-14 13:55:59 UTC | #6
Jerome.Saint-Marc, post:5, topic:18868
{
"flowId": "ec866884-2c19-41cf-a04f-bd602102f956",
"name": "Work Flow test passing parameters",
"inputData": {
"Flow.MyFirstInput": "tra la la",
"Flow.MySecondInput": "tsouin tsouin"
}
}
Hi,
Then I think it's a bug in the new API Explorer for that endpoint as it does not allow me to form a json payload in that way. Cannot form in the dialog fields or paste it directly. It expects an outer array.
IF I use the old api explorer and just paste the json payload in, it works.
tim.smith | 2023-03-14 13:59:21 UTC | #7
Please open a case with Genesys Cloud Care to report the incorrect API definition that's causing that format in API Explorer. It's behaving correctly per the definition, but the definition appears to be wrong. The issue with the API definition has to be reported via Care to be investigated and fixed.
system | 2023-04-14 13:59:39 UTC | #8
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 18868