Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to capture "ErrorCode: NOT_FOUND" in Dialogflow CX Webhook and use it to create flows

Hi everyone!

I am currently developing a webhook in Dialogflow CX that connects to an external API. I am facing a challenge: when the API returns the error "ErrorCode": "NOT_FOUND", I would like to capture this error code in the webhook and create a parameter for it. My goal is to use this parameter to condition conversation flows, allowing me to direct the user to different pages depending on whether the API is functioning correctly or not.

I have tried using Event Handlers to handle this situation, but I haven't been able to configure them as expected, and I'm not entirely sure how to use them. Therefore, I'm considering the possibility of passing the ErrorCode as a parameter.

Kozato_0-1729517916279.png

Has anyone encountered a similar situation and could share insights on how to capture this error in the webhook and effectively set up the parameters? Any help or practical examples would be greatly appreciated!

Kozato_0-1729518491212.png

Thank you for your attention!

 

Solved Solved
0 1 749
1 ACCEPTED SOLUTION

Hi @Kozato

Welcome to Google Cloud Community!

Using parameters to handle API errors in Dialogflow CX might be an effective approach. To achieve this you might consider following these steps : 

  1. Modify your webhook to extract the error code -  When the external API returns the “ErrorCode: NOT_FOUND”, extract the value and store it in a variable. 
  2. Set up Parameter in Dialogflow CX - Choose the page where you want to handle the error. Add a condition to check the session parameter ErrorCode. Use this condition to branch the conversation flow.  
  3. Direct the conversation Flow - Use the session parameter in your flow to handle different scenarios based on the API response.

You also visit the following documentation for more detailed information about handling webhooks and error codes in Dialogflow CX: 

I hope the above information is helpful.

View solution in original post

1 REPLY 1

Hi @Kozato

Welcome to Google Cloud Community!

Using parameters to handle API errors in Dialogflow CX might be an effective approach. To achieve this you might consider following these steps : 

  1. Modify your webhook to extract the error code -  When the external API returns the “ErrorCode: NOT_FOUND”, extract the value and store it in a variable. 
  2. Set up Parameter in Dialogflow CX - Choose the page where you want to handle the error. Add a condition to check the session parameter ErrorCode. Use this condition to branch the conversation flow.  
  3. Direct the conversation Flow - Use the session parameter in your flow to handle different scenarios based on the API response.

You also visit the following documentation for more detailed information about handling webhooks and error codes in Dialogflow CX: 

I hope the above information is helpful.