How to get Username in Webchat

时间:2017-08-30 08:34:55

标签: c# query-string botframework chatbot web-chat

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 个答案:

答案 0 :(得分:1)

这在IFrame WebChat控件中是不可能的。此外,您设置的用户名仅用于屏幕截图中显示的显示名称。这不是一个功能,并且没有计划在将来支持它。这可能不是您正在寻找的答案,但至少您可以停止搜索答案和疑难解答。祝你好运!