For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
In enterprise digital assistant use case, MS Teams is going to be the blockbuster channel for accessing the digital assistants. I am trying to enable the DAs in MS team though need some help in documentation or any blog, article on how can we pass user details from MS Teams to ODA. Appreciate your help.
Hi Pawan,
MS Teams as well as other channels like Slack don't have the same mechanism as the Web SDKs because the user is already identified in the system.
The approach used for these channels is to call the provider profile resolver and get the user information from there.
So you can create a simple custom component to access the user name.
1. Fetch the conversation object and get the conversation ID
2. Make GET request to https://smba.trafficmanager.net/in/v3/conversations/' + convID+ '/members' to obtain profile information
Thanks and Regards,
Rohit Dhamija
1. You need to make call to https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token to obtain the token. Here is the code snippet for reference purpose only:
try {
let jsonInput = {
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"scope": "https://api.botframework.com/.default"
}
let options = {
url: "https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token",
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
formData: jsonInput
};
let data = await request(options);
return JSON.parse(data.body);
} catch (error) {
throw new Error(error);
}
2. Then, you will use this token to fetch profile information, here is the code for reference purpose only
try {
let options = {
url: "https://smba.trafficmanager.net/in/v3/conversations/"+conversationId+"/members",
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer '+token
}
};
let data = await request(options);
return JSON.parse(data.body);
} catch (error) {
throw new Error(error);
}
Hope this helps!
Thanks Rohit, is client_id and client_secret same which we get while registering bot channel in azure?
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
Also could you help me with syntax how to get conversation id, is it somethign we can see somewhere in ODA page?
Is client_id and client_secret same which we get while registering bot channel in azure?
>>
Also could you help me with syntax how to get conversation id, is it somethign we can see somewhere in ODA page?
>> const userID = conversation.payload().userId;
conversation.logger().info("conversation user ID = "+ userID);
In coversation.payload will give you JSON, from there you can extract the conversation ID
Hi Vikhil,
Here is the POC to get conversationID in MS Teams
1. Use below custom code
'use strict';
module.exports = {
metadata: () => ({
name: 'msteams.convid',
}),
invoke: (conversation, done) => {
let email = conversation.payload()["userProfile"] ? conversation.payload().userProfile.userProfileDetails[0].email : "rohit.dhamija@gmail.com";
let name = conversation.payload().from.name;
let conversationId = conversation.payload().conversation.id;
conversation.logger().info('email: '+ email);
conversation.logger().info('name: '+ name);
conversation.logger().info('conversationId: '+ conversationId);
conversation.reply('conversationId: ' + conversationId);
done();
}
};
++++++++++
2. Here is the sample bot BotML code
states:
findMSTeamsuserID:
component: msteams.convid
transitions:
return: "done"
3) Create MSTeams channel and route it through the skill
4) Just type Hi in channel, you will get conversation ID as reply. Also you can check conversation logs.
Published tech exchange article on the same: https://blogs.oracle.com/mobile/how-to-query-user-profile-information-for-the-ms-teams-channel-in-oracle-digital-assistant
Is client_id and client_secret same which we get while registering bot channel in azure?
>>
Also could you help me with syntax how to get conversation id, is it somethign we can see somewhere in ODA page?
>> const userID = conversation.payload().userId;
conversation.logger().info("conversation user ID = "+ userID);
In coversation.payload will give you JSON, from there you can extract the conversation ID