How to differentiate two users in Microsoft Teams? - microsoft-teams

If I have the two users in the Microsoft Teams with the same name like "John Smith" .we can add two users with same name but different email id. Now in the API to get the channel messages the response will be its part of response like:
"mentions": [
{
"id": 0,
"mentionText": "John Smith",
"mentioned": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "5fc21b65-9c9b-4b73-ac2c-d5dafe1cf08f",
"displayName": "John Smith",
"userIdentityType": "aadUser"
}
}
}
but in this response I am not getting the email id to verify from which user we got the response if I have two John smith.How to tackle this situation

#NDD Once you get the id of the user you could use that id to make an api call to fetch users profile. There you could get the email id of the user.

Related

Mentioning a tag when posting a channel message from a teams bot

I would very much like to mention a tag when creating a teams message. I read the tag ID from Microsoft graph (I've also tried fetching tag id from an incoming message).
I can do this as my self using Microsoft Graph api with the following payload
{
"body": {
"contentType": "html",
"content": "<div>New incident ##### assigned to <at id=\"0\">App operations</at></div>"
},
"mentions": [
{
"id": 0,
"mentionText": "Operations",
"mentioned": {
"application": null,
"device": null,
"user": null,
"conversation": null,
"tag": {
"id": "my tag Id which I got using graph lookup",
"displayName": "App operations"
}
}
}
]}
Is this at all possible using the bot framework? Can the payload be manipulated to do this?
Right now, it is not supported to mention a tag using bot. The possible workaround is to use Graph API in the bot. To do that you can refer to this sample. Follow this to Add authentication to a bot. You will need to add the required permission and call the required API in sample.

Microsoft Graph Communications - Bot joining call - Microsoft Teams

Ok. So let me try to set the stage here.
I have a Microsoft Teams Application that has a Bot (Bot Framework v4) associated with it.
I have a use case where when a specific type of compliance activity happens, I need my bot to join the scheduled meeting and participate.
I am able to send a meeting invitation to an email account associated with the bot, and the bot accepts the invite.
According to this documentation, I should be able to join the meeting in progress.
(https://learn.microsoft.com/en-us/graph/api/application-post-calls?view=graph-rest-1.0&tabs=http) - Specifically "Example 5"
According to what I am reading, once you have the required Graph Permissions on your App Id that's associated, you only need 3 pieces of information to join the call (Passed in through a communications/call/create).
Post to https://graph.microsoft.com/v1.0/communications/calls :
Body:
{
"#odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"requestedModalities": [
"audio"
],
"mediaConfig": {
"#odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": []
},
"chatInfo": {
"#odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_XXXXXXXXXXXXXXXX#thread.v2",
"messageId": "0"
},
"meetingInfo": {
"#odata.type": "#microsoft.graph.organizerMeetingInfo",
"organizer": {
"#odata.type": "#microsoft.graph.identitySet",
"user": {
"#odata.type": "#microsoft.graph.identity",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"tenantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"displayName": "Drew Jenkel"
}
},
"tenantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"allowConversationWithoutHost": true
}
}
Upon doing this, I'm getting a 403 / Forbidden:
{
"error": {
"code": "7505",
"message": "Request authorization tenant mismatch.",
"innerError": {
"request-id": "30739bd2-37b2-4bfc-9c52-36d72a4aa54e",
"date": "2020-06-08T16:47:36"
}
}
}
Has anyone seen anything this this?

Cannot get email address when getting Teacher information from student account (OAuth scope is email ON)

I want to get the account information of the teacher of the course from the student's account and send the email to the teacher, or extract the email sent by the teacher from the inbox.
STEP1 GET https://classroom.googleapis.com/v1/courses
STEP2 GET https://classroom.googleapis.com/v1/courses/{courseId}/teachers
//response example
{
"teachers": [
{
"courseId": "1043XXXXXXX",
"userId": "1031xxxxxxxxxxxxxxxx",
"profile": {
"id": "1031xxxxxxxxxxxxxxxx",
"name": {
"givenName": "testName",
"familyName": "testFamilyName",
"fullName": "testName testFamilyName"
},
"photoUrl": "https://lh3.googleusercontent.com/.......photo.jpg",
"permissions": [
{
"permission": "CREATE_COURSE"
}
]
}
}
]
}
//end
I set OAuth scopes are follows,
https://www.googleapis.com/auth/classroom.profile.emails
https://www.googleapis.com/auth/classroom.profile.photos
https://www.googleapis.com/auth/classroom.rosters
https://www.googleapis.com/auth/classroom.rosters.readonly
But teacher's profile model has not emailaddress field.
How can I get an email address?
Do I need to any configure my Teacher account?

Microsoft bot framework for teams capturing unique user id

We are building a product integration using ms teams and ms bots. We are having an existing integration with Slack already. In the slack World we identify a unique user by TEAM_ID and USER_ID . In case of Teams I can see even id in the from node is a very long string suggesting its unique. Below payload is one example coming to our server. Can someone confirm if using id from the from node is wont change a particular user ever?
the user id being assumed unqiue to a user below is "29:1374Bmi6ngJLBlF9oGVcDuTaBbMfJmcOF9eUvQVdx_rgYh5spPNQ5Mi6fLdVvCiT7mQPMNytT0zGk_iAUtvqKAwXXXX"
{
"_activity": {
"id": "1576102076169",
"from": {
"id": "29:1374Bmi6ngJLBlF9oGVcDuTaBbMfJmcOF9eUvQVdx_rgYh5spPNQ5Mi6fLdVvCiT7mQPMNytT0zGk_iAUtvqKAwXXXX",
"name": "My Name",
"aadObjectId": "37a2516a-baf2-41d8-a406-a067888d676c"
},
"conversation": {
"conversationType": "personal",
"tenantId": "9bfb3569-994e-4908-855c-c7f6c1a94100",
"id": "a:1DcGjCAgiuinvuzR0Mx6dR9uJOB3YUwjMdLOiGTAwQ7KWSGsiEijNfvir66ep7k0fABwoSXxCAACx2_3GflfTNIZL7XMkfjrMm0v8OzJJ7vvIFKasqrClrZ_T-8dDfdT0"
},
"channelData": {
"tenant": {
"id": "9bfb3569-994e-4908-855c-c7f6c1a94100"
}
},
"text": "contact mat",
"textFormat": "plain",
"type": "message",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/amer/",
"recipient": {
"id": "28:a835cf1d-83a8-4ae9-845a-23a68a1df442",
"name": "FlashCX.ai"
}
}
}
#Moblize IT Yes the id obtained from activity.from.id is the unique id for user and it wont change.

Trustpilot invitation api weird result

Trying to create invitations using their API, I get a proper result back, however the status is "notsent". There is zero debug information to go by, so I'm wondering if anyone else has seen this and might have ideas for fixing the issue.
Here's an example of a response I got from their api:
{
"businessUnitId": "<business unit id here>",
"businessUserId": "<business user id here>",
"createdTime": "2018-10-02T09:58:35.135569Z",
"id": "<invitation id here>",
"locale": "da-DK",
"preferredSendTime": "2018-10-09T09:58:34Z",
"recipient": {
"email": "<email goes here>",
"name": "<name goes here>"
},
"redirectUri": "http://trustpilot.com",
"referenceId": "<our ref id>",
"replyTo": "trustpilot#boozt.com",
"sender": {
"email": "noreply.invitations#trustpilotmail.com",
"name": "Booztlet.com"
},
"sentTime": null,
"source": "InvitationApi",
"status": "notsent",
"tags": [],
"templateId": "57cfc1a660e1cc0620b53a38"
}
So, the NotSent status code is expected for new invitations. This is because invitations are sent asynchronously - at around the time you put in as your "preferredSendTime".
If you login to your account at https://businessapp.b2b.trustpilot.com/#/invitations/invitation-history, you should be able to see the invitation you created, and whether it was sent or not (since you specified October 9th as your preferredSendTime, the invitation will still be queued until that point)

Resources