Reputation: 1088
I intend to send a greeting message from the bot on Skype for Business when the user initially opens the chat window. To achieve this I'm trying to respond to the conversationUpdate event from the bot. When I respond to the conversationUpdate event, i receive the following error that conversation does not exits
{"Error":{"Code":"ServiceError","Message":"Conversation does not exist"}}
But when the same user sends a message, I receive the message with the same conversationId and am able to respond back without any issues.
I'm able to do this without any issues on the web chat but not on SfB. I looked at some issues on Microsoft's GitHub repository for the bot, which suggested that the question may be best answered on SO.
Updates
I was earlier on SfB 2013. I've upgraded to SfB 2016 and the bot responds to the conversationUpdate event it receives once the user sends his first message. Usually on a web chat, the response to the first conversationUpdate is sent as soon as the user opens the window and a second response is sent once the user sends his first message. In the case of SfB, the response to second conversationUpdate is working but not for the first conversationUpdate.
As explained above, the response to first conversationUpdate will result in the
Conversation does not exist
error. The response to the second conversationUpdate when user sends his first message works.
So now how do we make the welcome message work for the first conversationUpdate and disable it for the second conversationUpdate update ?
Upvotes: 2
Views: 189
Reputation: 2541
I am not sure, why converstaionUpdate
event didn't triggered. But as mentioned in BotFramework docs, not every channels supports that event. You can add a first run
dialog instead and check if that works. Adding a sample from the docs page:
// Add first run dialog
bot.dialog('firstRun', function (session) {
session.userData.firstRun = true;
session.send("Hello...").endDialog();
}).triggerAction({
onFindAction: function (context, callback) {
// Only trigger if we've never seen user before
if (!context.userData.firstRun) {
// Return a score of 1.1 to ensure the first run dialog wins
callback(null, 1.1);
} else {
callback(null, 0.0);
}
}
});
Upvotes: 2