-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bot.on('conversationUpdate') repeats itself in webchat #2093
Comments
I also ran into this problem. The webchat is sending the ConversationUpdate twice. I think the WebChat got updated some days ago (buttons were not working before) and this bug slipped into it with the update... I hope it gets fixed soon. |
Hi @ajayp and @fingejo, the Direct Line channel sends multiple ConversationUpdate messages. The first ConversationUpdate is sent when the bot is added to the conversation. You can read more about this here: #2065 (You can tell if the member added was a bot by comparing each conversation.MembersAdded[i].Id to activity.Recipient.Id.) |
@dandriscoll - Thanks, I was using bot.on('conversationUpdate') to send a custom greeting to the user when the bot is initiated, is there another way to present a custom greeting? |
@ajayp, @dandriscoll Would you be able to check if the your bot is one of the members added? If so, do you have any idea on how to do this? Thanks! |
@ajayp and @mushroomcakes, you can tell the difference between your bot and a user by checking the ID field of each element of activity.membersAdded.
|
If you need to send a message when the bot joins a conversation, you may use the following snippet: bot.on('conversationUpdate', function (activity) {
if (activity.membersAdded) {
activity.membersAdded.forEach((identity) => {
if (identity.id === activity.address.bot.id) {
var reply = new builder.activity()
.address(activity.address)
.text('Hi there!');
bot.send(reply);
}
});
}
}); |
@dandriscoll @pcostantini - Thanks for the information, that works. |
In node I had a small issue, I had to write |
This issue only started occurring in the past few days.
I am using bot.on('conversationUpdate') as a greeting when the webchat iframe first appears. I see my greeting, but if I then type something into webchat and hit enter, the greeting is output again, this only happens when the first conversation is initiated in web chat.
The text was updated successfully, but these errors were encountered: