简体   繁体   中英

How to get Username in Webchat

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?

在此处输入图片说明

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM