watson-developer-cloud / conversation-connector

The Conversation connector is a set of components that mediate communication between your Conversation workspace and a Slack or Facebook app. Use the connector to deploy a chat bot that Slack or Facebook Messenger users can interact with.
Apache License 2.0
28 stars 62 forks source link

Messages not getting passed in #53

Closed CJohnDesign closed 5 years ago

CJohnDesign commented 6 years ago

Hi,

I'm noticing that every so often certain messages don't get passed from FB messenger to Watson Assistant. Screen shot attached.

You can see that my two last messages of "reset" show up in the Improve section but my "Hi, I'm just looking..." message is not passed along nor is it responded to by the bot.

watson assistant - fb screen shot

Thanks!

dgterry commented 6 years ago

Hi @CJohnDesign nothing in the messages you are sending look like they would be causing problems. Still, I wonder if it could be something about the specific message that the code is having issues with.

If errors occur the bot typically logs information in Cloud Functions but doesn't surface these failures to the user. Could you try going to https://console.bluemix.net/openwhisk/dashboard and seeing if there is anything there? More specifically, once it loads up make sure the region, org, and space match the values of the Assistant service you did the deploy from (if not selected already). Then you'll want to look in the activity log in the top right of the page. If you can reproduce the problem I'd say talk to the bot and then refresh the activity log widget to get the latest information. If you can't then just browsing looking for red X's is worthwhile. I'd pay special attention to any receive actions that have a red x. You can click the red x to get a summary of what happened or you can click the alphanumeric string under the action name to bring up a new tab with further details about what happened when that action ran. Receive is the first action that is hit when facebook sends the bot a message so it would be good to see if the action fires at all, if it fails, etc. It's possible other actions have failed as well. Hopefully something here will give us further clues as to why your bot isn't getting messages to your workspace.

CJohnDesign commented 6 years ago

Excellent. Here is what it said after clicking the alphanumeric string in the activity log:

{"duration":720,"name":"receive","subject":"cjohndesign@gmail.com","activationId":"b10e522a618c4e7b8e522a618c6e7b8d","publish":false,"annotations":[{"key":"path","value":"cjohndesign@gmail.com_dev/conversationconnector_facebook/receive"},{"key":"waitTime","value":10},{"key":"kind","value":"nodejs:6"},{"key":"limits","value":{"timeout":60000,"memory":256,"logs":10}},{"key":"initTime","value":406}],"version":"0.0.1","response":{"result":{"error":"Verfication of facebook signature header failed. Please make sure you are passing the correct app secret"},"success":false,"status":"application error"},"end":1531166403136,"logs":[],"start":1531166402416,"namespace":"cjohndesign@gmail.com_dev"}

I bolded the error. Anyone else getting this issue? I will bring it up to my IT department.

dgterry commented 6 years ago

Hi,

The verification failure would happen if Facebook is sending different app secrets, page tokens, or verification tokens than the connector was given at the time of deployment. But I would expect all of your messages to fail if that was the case.

The fact that some succeed and some fail makes me think that some characters in the message are causing problems. Facebook basically sends the user's message encoded with the 3 tokens I mentioned earlier and if the bot can't decode them things will fail. So I'm guessing the encoding/decoding of the payload is having issues in some cases vs there being anything wrong with the tokens.

I tried to reproduce this using a web browser messenger client and the string in your screenshot but could not. What messenger client are you using? I wonder if things consistently work if you avoid punctuation, apostrophes and non alphanumeric characters?

CJohnDesign commented 6 years ago

I'm using Watson Assistant.

I couldn't find strong correlations with punctuations. Character count seems to be an issue in a lot of cases but this morning it got stopped up by short commands and it threw the same error and a different error. The new error: {"error":{"message":"Unknown Error From API: socket hang up","stack":"OpenWhiskError: Unknown Error From API: socket hang up\n at Client.handleErrors (/nodejsAction/node_modules/openwhisk/lib/client.js:156:11)\n at rp.catch.err (/nodejsAction/node_modules/openwhisk/lib/client.js:11

I'm meeting with my IT department today. I'll talk to them about contributing to the repo. (which by in large is working great!)

Thanks!

dgterry commented 6 years ago

Hi, I saw that issue this morning as well (the socket hang up), it was due to some issues with Cloud Functions that I believe are resolved now. I'm no longer seeing it at least. Maybe give things another try when you can?

CJohnDesign commented 6 years ago

Confirmed, back online.