SOLVED

How to Get MS Teams Locale while Adding bot to MS Teams

Copper Contributor

Hi Team,

 

While users adding a bot in my MS Teams, we need to send a welcome card based on the Locale.
While the bot has been added to the user, OnMembersAddedAsync() has been triggered.

 

But string userLocale = turnContext.Activity.GetLocale(); is returning the null value. Could you please suggest, how to fix this issue?

 

Thanks in Advance!!!

1 Reply
best response confirmed by ChetanSharma-msft (Microsoft)
Solution

@maheshkumargunasekaran - As the bot activity is not initiated by the user action such as sending message. The bot doesn't received any locale information and this is by design and there is no fix for it. Once user sends a message or interact with the bot you can store this information for further interactions.

Also you can have default locale based on the area where application is being used.

Thanks, 

Hunaid L Hanfee

------------------------------------------------------------------

If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

1 best response

Accepted Solutions
best response confirmed by ChetanSharma-msft (Microsoft)
Solution

@maheshkumargunasekaran - As the bot activity is not initiated by the user action such as sending message. The bot doesn't received any locale information and this is by design and there is no fix for it. Once user sends a message or interact with the bot you can store this information for further interactions.

Also you can have default locale based on the area where application is being used.

Thanks, 

Hunaid L Hanfee

------------------------------------------------------------------

If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

View solution in original post