botframework-sdk
botframework-sdk copied to clipboard
How to chatbot start conversation user open chat window.
How to chatbot take initiative for chat when user open any channel then chatbot send "Hello, How can help you?" to user ? I want above functionality in web control channel using direct line api.
@danmarshall @eanders-MS can you specify an initial greeting message in the new web chat control?
No, this is not specified in the WebChat Control - it is created by your bot.
Please Take a look at EchoBot's Controller in BotBuilder SDK . As mention, you can change the ConversationUpdate for your requirement.
case ActivityTypes.ConversationUpdate:
IConversationUpdateActivity update = activity;
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, activity))
{
var client = scope.Resolve<IConnectorClient>();
if (update.MembersAdded.Any())
{
var reply = activity.CreateReply();
foreach (var newMember in update.MembersAdded)
{
if (newMember.Id != activity.Recipient.Id)
{
reply.Text = $"Welcome {newMember.Name}!";
}
else
{
reply.Text = $"Welcome {activity.From.Name}";
}
await client.Conversations.ReplyToActivityAsync(reply);
}
}
}
thank you @SathishNeel :)