cancel
Showing results for 
Search instead for 
Did you mean: 

error handling in sap conversational ai chat bot

nithinkrishna
Explorer
0 Kudos

Hi,

I am consuming a api service in my chatBot. When my api service executed successfully am giving a message and its working perfect(case1.png). But whenever my api service fails or gives an error(case2.png) i want to show another message, so how can i handle the error when my api service fails?

Note:Please find the screenshots case1.png and case2.png so that you will get an idea of my question.

Regards

nithin

Accepted Solutions (1)

Accepted Solutions (1)

JonasB
Contributor
0 Kudos

Hi Nithin,

you can use conditions to execute actions only when the API returned an error, e.g.
_api_service_response.default.status_code is not 200

With this approach, you'll have one message group for executing the API call, one for handling the error case and one message group with the actions for the success case.

Regards
Jonas

Answers (1)

Answers (1)

former_member667434
Active Participant
0 Kudos

Hi Nithin,

Capture your response variable in a memory field and add a block with check if memory.yourvariable is not something (I.e blank) display your custom message.

Thanks

Ashutosh

nithinkrishna
Explorer
0 Kudos

Hi ashutosh,

Thank you for the response.

Yes i got to know that i have to add a block of code(if condition code). can you tell me specifically where i can add that block of code?

Regards

nithin

former_member667434
Active Participant
0 Kudos

Hi Nithin,

Store your API response for the required fields in variable using "{{api_service_response.Value.body.id}}".

Post that use a block to check to check if the variable has value using _memory.<your variable> is blank. Below screenshot may help.

Thanks,

Ashutosh