Showing results for 
Search instead for 
Did you mean: 

How can I use Scripting Syntax in SAP Conversational AI to adjust JSON data response from API call?

0 Kudos

Hi there,

I am currently developing a bot that uses data from an API call to a backend CDS view. I want the user to be able to select an option from a list of buttons to proceed to the next step

the data that populates the button is coming from the API response. Is there a way using scripting syntax to remove duplicate values from the buttons?

I have tried to use the unique helper on the array being returned but this will not work as each object in the array is already containing unique values.

Any advice would be appreciated.



View Entire Topic
0 Kudos

Hi Leila,

you could use the pluck helper to first extract the button values in an edit memory action as a flat array of values and pass this into the unique helper.

e.g. in the set variable action

{{unique (pluck api_service_response.default.body.results "") }}