I used this code to send a different message if a new user start conversation :
IConversationUpdateActivity update = message;
var client = new Connec
Facebook includes the conversation itself in the list of members:
So you need to change the if
statement to this:
if (newMember.Id != message.Recipient.Id && newMember.Id != message.Conversation.Id)
{
// send welcome message
I'm looking into the facebook Name part... You should be able to just plug in this code:
else if (message.Type == ActivityTypes.ConversationUpdate)
{
IConversationUpdateActivity iConversationUpdated = message as IConversationUpdateActivity;
if (iConversationUpdated != null)
{
ConnectorClient connector = new ConnectorClient(new System.Uri(message.ServiceUrl));
foreach (var member in iConversationUpdated.MembersAdded ?? System.Array.Empty<ChannelAccount>())
{
// if the bot is added, then
if (member.Id == iConversationUpdated.Recipient.Id)
{
var reply = ((Activity)iConversationUpdated).CreateReply($"Hi Friend I'm Botty McBotface");
connector.Conversations.ReplyToActivityAsync(reply);
}
}
}
}