Hey Geert Jan!
I understand the problem that with every call, you want to send data based on a different context. There are several solutions to this problem. The one below is the most straightforward:
Using the ‘parameters’ parameter
The process ‘N_Call Template Build, Execute, Process’ has a parameter called ‘parameters’ of type ‘List<Tuple<String,Mixed>>’.
You can pass as many context records/data as you want. When the process reaches the default building step, then those parameters will be passed down to the process that uses the export definition/data definition to build the XML/JSON body of the call.
This happens by default if you set an export definition (or a data definition) at the call template:
Make sure that the linked export definition uses parameters (1) and that you defined some parameters. In my case, I set a parameter ‘prompt’ of type ‘string’. But you can really use any kind of parameter.
After adding a parameter, make sure that it is also used as a placeholder within the export definition. In my case, I put ‘%prompt’ in a field. Then i used an XSLT to get the following body: {“model”: “gpt-3.5-turbo”, “messages”: [{“role”: “user”, “content”: “%prompt”}]}.
To try out if everything works, you can use the test panel on the call collection page. Tuple lists have the following format " [ <“key1”,“value1”>,<“key2”,“value2”> ]"
In my case, I got this beautiful response:
Linking context records to a call
As an addition it is also possible to link the call record to a Novulo record and then only pass the current N_Call record to the export definition. For example, before building a call, you can set a field at the call and link it to an N_Purchase record with a process that you build. So, for example, call with ID 1 would be linked to purchase with ID 123. See M10069 ‘N_Call - Ensure purchase at call’ for example.
Then, only the parameter “call” can be passed to the export definition. Within the export definition, you can then access the purchase record via “%call.purchase”.
The advantage of this approach is that you can add the purchase field as a column in grids and that you can use it for filtering. If for example you executed multiple calls for purchase 123 you can add a list of all calls for a specific purchase to the purchase page.
Furthermore, when the process ‘N_Response - Process’ is executed, the purchase record can be accessed as well via ‘trigger.response.call.purchase’ to make changes to it. For example, one could update a status to ‘has been sent successfully’ or to ‘retry sending’ depending on the response.
If you want to process your received data similarly, let me know! In this case, I would like you to use ‘M10388 - Novulo Call template processes’ so that you can execute custom processes before/after building/processing calls.