Hi,
As i am using MS teams as my channel,I have a message node that welcomes user -“Hi {{context.session.UserContext.emailId}}”
But in teams it does not print the user email id followed by “Hi” instead it only prints just “Hi”.Same behaviour even if I use a entity node and within the bot responses I provide the same text.
MS Teams may not be sending emailId under UserContext and that is the reason it is unable to resolve it.
Can you please try this - For a message node, go to advanced settings and add a channel specific message in Java Script mode.
print(JSON.stringify(context)); //it will print a big JSON object
You may also try
print(JSON.stringify(context.session.UserContext));
Or
print(JSON.stringify(context.session.BotUserSession));
Ensure the bot is published.
You will know where the email Id etc. are coming from. It will be a big JSON but it will reveal much information. Hope this helps.
I have tried above but i m getting
either nothing in the msteams or [object Object]
Is there any other way to do it
@rajatjain4
This is what we go tot know from MS Teams support. They do not send email id hence it is out of Kore.ai’s control.
unfortunately, there is no straight forward way to extract the Email ID value from the activity object due to security reasons.
In from.aadObjectId of the Activity object there’s the AAD Object ID of the sender; from that you can look up the email address using MS Graph provided your appId has at least User.ReadBasic permissions . The email address is not included for privacy reasons, by design.
If your channel is MS Teams, then I guess, you’re using OAuth 2.0 using Microsoft Identity framework.
If yes, then below applies
I have successfully integrated MS Teams and solved this particular tasks by calling Graph API through a Service Node in Dialog tasks.
Endpoint URL: https://graph.microsoft.com/v1.0/me/
No parameters needed to be passed
This API returns JSON object with many user details with column “userPrincipalName” with email ID.
That way you know who is the user logged on and using chatbot. You can store this information and other details like displayName and etc in {{context.session.UserContext.firstName}}”, {{context.session.UserContext.emailId}}”, etc.
Use this context info later in other dialog tasks without needing to call MS graph API.
@vijay.thakkar I am trying to follow your post to check if I can do the same, I am stuck on creating an Auth Profile for oAuth2 that return “AzureOAuthStrategy requires a tenant id.” Please advise on your setup which may help me past this issue. Thanks in advance!
Hi Vijay ,
Could you please elaborate a litle bit.
We are not able to get the access token
Hi ,
Are you able to resolve the issue ?
Could you please help… I am also facing the similar issue.
Thanks in Advance!!
Hi Vijay ,
I am facing the similar issue.
I am not able to get the email id.
Could you please help me few steps how and where you have configured OAuth.
@awasthividhu
If the current problem is not being able to get the email id, Microsoft does not send it to Kore for security reasons. Please refer to the post above: Fetch UserContext details through channel
If this is about tenant id it seems the app you need to set up on Azure has not been set up correctly.