3

I am trying to get userName in chatbot application using latest bot version v4. How to get username in updated bot version v4?

1 Answer 1

5
/*In latest bot version v4, you can get userName using following code*/

public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
{
var userName = turnContext.Activity.From.Name;
await turnContext.SendActivityAsync($"Welcome - {userName }");
}
Sign up to request clarification or add additional context in comments.

1 Comment

Additionally, the MS Bot Framework has a v4 samples repo, one of which is a sample on how to get and display a user name (github.com/Microsoft/BotBuilder-Samples/tree/master/samples/…)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.