How to get Username in Webchat

911 views Asked by At

Im using the webchat control of the botframework. I tried setting the username via the iframe using querystring.

https://webchat.botframework.com/embed/YOUR_BOT_ID?s=YOUR_BOT_SECRET&username=DESIRED_USERNAME&userid=DESIRED_USERID

unfortunately during the

(message.Type == ActivityTypes.ConversationUpdate)

 if (message.MembersAdded.Any(m => m.Id == message.Recipient.Id))
            {
                var connector = new ConnectorClient(new Uri(message.ServiceUrl));
                var response = message.CreateReply();
                string replyMessage = string.Empty;
                if (string.IsNullOrEmpty(message.From.Name))
                {
                    replyMessage += "Hello there!\n\n";
                }
                else
                {
                    replyMessage += "Hello "+ message.From.Name +"\n\n";
                }

My message.from.name is empty. Im confused, because when i send a message it appears that my username is already set. How come during the conversation update it is still blank?

enter image description here

1

There are 1 answers

3
D4RKCIDE On BEST ANSWER

This is not possible in the IFrame WebChat control. Additionally, the user name you are setting is just for the display name as pictured in your screenshot. This is not a feature and there are no plans to support it in the future. This is probably not the answer you were looking for, but at least you can stop searching for the answer and troubleshooting. Good luck!