The botkit is not working for EU, DE region (403 forbidden)

Problem statement: When a bot developer configures the botkit for a bot in the US region (bots.kore.ai) it works for them. However, the same botkit when it is linked to a bot in the EU (eu-bots.kore.ai) region or DE (de-bots.kore.ai) Or JP (jp-bots.kore.ai) region, it does not work. The users is not able to get responses from the bot. Send user message is being logged in the reverse proxy (ngrok) but send bot message is not received in the botkit.

Troubleshooting:
Edit the file lib\sdk\lib\invokeSendMessageAPIs.js
Add a console log statement for sendBotMessage:
image
On interacting with the bot, I see 403 Forbidden.
image
On checking further with the NOC team what was revealed is -

  • Kore.ai XO Platform is hosted on AWS.
  • AWS has its own WAF (Web Application Firewall)
  • In the EU, DE, JP regions-, the AWS WAF version does not accept any HTTP request that does not have user-agent in the header.

Solution:

  • If you are hosting your botkit on a server that has proxy for outgoing calls, you can add user-agent in all the HTTP headers,
  • BotKit is a nodeJS middleware. It can be edited and tweaked as necessary. You can explicitly add the user-agent in the botkit code.

lib\sdk\lib\invokePlatformAPIs.js
image
Note: The botkit code in github will be updated to make it possible for the users to configure user-agent header easily. Till that time, please use this approach to get going with botkit implementation if needed

Output:


image

This has been resolved. The BotKit now offers the configuration of the user-agent in the config.json.

Please use the version commit number 1b5ecd5dc89317a5d2079883367b2d3b9fd067c1 or greater (13-June-2023).