BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

[Directline] Sorry message in bot script

Open Sandeepmahala opened this issue 6 years ago • 5 comments

We have a bot running on directline channel. It throws an error message intermittently as below

image

We have located this error message to SEND_FAILED_KEY in our bot script files. These script files we are generating from a React solution on GitHub and then pushing the scripts in our web solution.

Version of react solution - 4.5.3-0

Observations:

  • Request sent to Bot is responded and even logged in conversation logs but response in not rendered in webapp, instead the sorry message

  • Subsequent messages are not received by Bot

Sandeepmahala avatar May 21 '20 11:05 Sandeepmahala

It could possibly be one of the followings:

  • The message failed to deliver to the bot
    • Browser not able to deliver to the service and the bot
      • Can you open Developer Tools and investigate the traffic of "POST https://directline.botframework.com/conversations/..." and see if the HTTP request is success or not?
      • If this failed, it could means either the service, or the bot, is failing to respond on time
      • See screenshot below for a successful deliver case
    • The service not able to deliver to the bot
      • Can you check the log on your bot?
  • The bot failed to respond on time (< 20s, configurable)
    • Can you check the log on your bot?

Browser successfully delivered the message to the service and the bot

image

Circled are things to check.

compulim avatar May 21 '20 17:05 compulim

@compulim we are getting below POST traffic details for failed messages image What's more quizzing is that, we can see the message in our bot conversation logs (custom logging we do), but the the script file is triggering send failed key.

Sandeepmahala avatar May 26 '20 12:05 Sandeepmahala

@compulim can you take a look?

vishwacsena avatar Jun 15 '20 18:06 vishwacsena

Hi @Sandeepmahala,

There are few key criteria for Web Chat to consider the message successfully sent out, and all criteria must met within 20 seconds.

image

The POST /activities call must return as 200.

image

The POST /activities call has a channelData.clientActivityID, for instance it is 159...hmf here.

When you look at the Web Socket /stream, you should see the message sent out from the user, appear here.

image

So, there are 2 criteria:

  • The POST /activities call return 200
  • The outgoing message, but echoed back through the /stream Web Socket connection, with same channelData.clientActivityID

If both criteria met within 20 seconds, Web Chat will consider the activity sent successfully and turn the message status into "Sent at 1 minute ago".

Can you verify both traffic on your side?

compulim avatar Jun 30 '20 19:06 compulim

It seems that in case of a network issue (even for a second) bot is not able to re-connect and we are getting sorry messages for all the utterances.

I referred below article: https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-receive-activities?view=azure-bot-service-4.0#http-get

There are 2 ways to receive bot activities:

  1. via WebSocket
  2. via HTTP GET

Earlier, I was using HTTP GET and in case of a network glitch I was getting "Sorry messages" for all the user queries even after network is back because bot was unable to re-connect.

Now, I am using WebSocket and able to resolve the issue.

kanika-jain avatar Jul 01 '20 04:07 kanika-jain