I am currently debugging a Cognigy integration that uses Data Actions to pull customer data from a legacy SQL database. We are seeing a lot of ‘400 Bad Request’ errors when the Cognigy bot sends a payload that contains special characters or non-UTF-8 strings. The bot flow just crashes and the customer is disconnected. How can I make these Data Actions more resilient to malformed data from the bot?
Hello Isa47. I am an email routing specialist and I have seen similar issues with HTML templates. You should use the ‘Success Template’ and ‘Error Template’ features in the Data Action configuration. You can write a Velocity macro to sanitize the input from the bot before it is sent to your database. For example, you can use ${input.accountNumber.replaceAll("[^0-9]", "")} to ensure that only digits are passed through.
I have seen these 400 errors show up as ‘System Failures’ in our dashboards. Sak41 is right about Velocity, but you should also implement a ‘Validation’ step in your Cognigy flow before you ever hit the Data Action. If the data is malformed, the bot should ask the customer to re-enter it instead of just sending it and hoping for the best. It is much better for the customer experience.
Greetings! I manage a large organization in Japan and we use Cognigy for everything. Isa47, if you are seeing UTF-8 issues, check the ‘Content-Type’ header in your Data Action. It must be set to application/json; charset=UTF-8. I have seen many people leave off the charset part and it causes havoc with Japanese characters. I am an enthusiastic evangelist for proper header configuration!