I am currently evaluating Microsoft Teams Graph API endpoints for us and our customers. Our goal would be to compile a list of past callRecords for a specific user.
Since the API does not (currently) offer an endpoint to just fetch a list of past/done callRecords we need to subscribe to the /communications/callRecords notifications.
Using the example project specified in the documentation ( https://github.com/microsoftgraph/nodejs-webhooks-rest-sample) we successfully created subscriptions and were also able to update these subscriptions (not part of the example project).
I am running the example project on my local machine using ngrok as suggested.
So far everything works, but we do not get any notification. I made various calls with the Teams Desktop App using the same user that gave admin consent for accessing callRecords but I never received a notification on any test subscription.
The current active subscription in question is "07b23247-66d9-46b9-ac67-a72d5d702628" and was created around 2020-09-09T09:20:00.000Z (I do not have the precise minute/seconds). It since then has also been successfully renewed.
Here is an extract of the subscription creation response:
{
'#odata.context': 'https://graph.microsoft.com/beta/$metadata#subscriptions/$entity',
id: '07b23247-66d9-46b9-ac67-a72d5d702628',
resource: '/communications/callRecords',
changeType: 'created',
expirationDateTime: '2020-09-12T07:20:09.036Z'
}
I do monitor all incoming traffic using ngroks http://127.0.0.1:4040 endpoint and so far I only received the validationToken requests. That tells me that the endpoint does indeed receive requests.
I am currently at a loss as where to look further for an error on my side.
I opened this stack overflow is as it is the requested action to take according to the troubleshoot section of the example project (https://github.com/microsoftgraph/nodejs-webhooks-rest-sample/blob/master/TROUBLESHOOTING.md).
Related
The organization that I work for previously used Slack as our collaboration tool. With Slack, I was able to register an app in the workspace and use the provided access tokens to invoke the API to send a message to a user from our external web application. It was very straightforward. There was no intermediate app that needed to be coded to enable this messaging.
Recently, we've transitioned from Slack to MS Teams, and in looking over the Graph API documentation, there does not currently appear to be a way to proactively send a message from an external application to a user. The available permissions for the chatMessage endpoint indicate the availability of only a delegated permission to send a message on behalf of a specific user; no permission exists to send a message on behalf of an external application.
Is it possible to use the Graph API to directly send a message from an external application to a user? Or must a bot application be created in order to achieve this?
It must be a bot application to achieve above mentioned requirement. ChatMessage endpoint works to send a message on behalf of user only.
Our company now uses ms teams. Whenever an incomming or outgoing call is made the name of the company or customer is not displayed in teams. So I need to display details to that call in a custom app. Therefore I wanted to use the callRecord subscription.
But in order to get the subscription working with my app, I need to have an API that gets all the subscription calls and provides the data via websockets to my app, right?
Isn't it possible that the app gets the subscriptions?
Today Microsoft graph change notifications only support delivering the change notifications gtuys webhooks/http post.
If you want those change notifications to be delivered to your front end application via Web sockets, you need to build your own backend solution to receive the change notifications via http post and relay it via Web sockets. Additionally you can request the feature on uservoice
I have an app that creates subscriptions for office365 users and does something whenever it gets a notification.
For 99% of users it works fine.
There's one user that I can't create subscription for even though he has an enabled exchange plan.
When I try to create subscription for him I get status code 404 and message: REST API is not yet supported for this mailbox.
However, I can list the user messages (i.e. mails) with API (GET request to https://graph.microsoft.com/v1.0/Users/{user_id}/messages)
Is it normal behavior? That user have no rest services enables for his mailbox (and therefore cant create subscription) but other rest services such as listing messages works just fine?
You are most likely getting this error because the organization has an hybrid deployment (Exchange on prem "linked" to the organization) and the mailbox that's failing is located on premises, not in the cloud.
Your application should handle the error and/or let the administrators know that this mailbox is failing, but there isn't much that can be done besides migrating the mailbox. For reference
I have a Office 365 Business Essentials Exchange Online Shared Mailbox I need to retrieve changes for on a scheduled basis. Access to this mailbox is granted to an AzureAD registered app via the Microsoft Graph API Mail.ReadWrite application permission. Admin consent has been acquired. Mailbox access is limited to just this one mailbox through an ApplicationAccessPolicy.
As this is a simple test case on a brand new mailbox that only contains a handful of test emails, I didn't use any filters or search terms. The initial request is in the format: https://graph.microsoft.com/v1.0/users/{ID}/mailFolders/{ID}/messages/delta?$select=sender,receivedDateTime,subject,body
I have no issues retrieving an access_token. The initial request and subsequent nextLink requests return results without issue as well. However, making a request against the deltaLink always returns an empty dataset. This occurs regardless of any changes made to messages in the folder since the deltaLink was retrieved. Instead I get the following response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(message)",
"#odata.deltaLink": "https://graph.microsoft.com/v1.0/users/{id}/mailFolders/{id}/messages/delta?$deltatoken=GoHFWffpmGHQHQdBstC3TW7TDQ4HvoU5hdqPXQ_DvM724L0CdVdFzRNBLVaICnIxrI9zMjxaHP7k0ncrSZj9L48EjNP7Hveu8IgKvkNUCGoRun6G89JzwGgNqn93Z4L5vtS8Fup2E6W6VD4LKMWehk5I6xWxPJMy8WwKsSrm8AJA0phlbIrqciV6G3MiQ67Q.xJrwL7OVVHnlcdTlcdctrLBRzRHLUZnpFCxbZL7MrCg",
"value": []
}
This behavior occurs whether I run the query from the registered application or via my own account using the Microsoft Graph Explorer.
Am I missing a step somewhere along the way or is this a bug? If the latter does anyone know of a workaround?
I am trying to make a bot that will listen to all public & private channels, and IMs for a team, and will reply when it sees certain trigger words. This will be a "Slack App", installable to your team using the "Add to Slack" button, and includes a "Bot User".
I have asked for the "bot" OAuth scope, and subscribed to the "message.channels,message.groups and message.im" Team Events (at https://api.slack.com/apps/myAppId/event-subscriptions) but do not appear to receive event POSTs through the Events API when new messages are sent.
Adding the "channels:history,groups:history,im:history" scopes makes the bot receive these event POSTs, but I believe only for the user that added the bot, so it will not watch groups that the adding-user was not a member of, or IMs between 2 other users. This means that behaviour will be different, depending on which user installed my bot.
Is there a way of installing the app/bot for an entire team? The documentation seems to indicate that a 'bot' scope should have the ability to receive events, but I am not seeing this (I require the channels:history scope etc. above).
bot - request this scope when your Slack app includes bot user functionality. Unlike incoming-webhook and commands, the bot scope grants your bot user access to a subset of Web API methods, the RTM API, and certain event types in the Events API.
(from https://api.slack.com/docs/oauth-scopes)
The page on bots also claims that a bot can receive all messages through the RTM API:
This websocket will send you all of the messages and activity that happen in public and private channels that the bot user is invited to, as well as messages that are sent to it via direct message. A bot user opens this websocket with the RTM API by sending an authenticated call to the rtm.start API method. To learn more about connecting to the RTM API, read the documentation here.
(from https://api.slack.com/bot-users)
Is this same behaviour possible in the events API without needing to use the RTM API or add those additional scopes mentioned above?
I see from your comment that you have understood that the bot scope (and the channels.message Events subscription) allows your bot to receive from channels it is present in.
You have two options
1) you ask for channel.write scope in addition to bot, and you invite the bot in all channels (using the user token, not the bot token)
2) you work on your onboarding and figure out a way to get your "champion", ie the user who installed your app, to invite your bot in relevant channel.
Keep in mind that solution 1) is usually seen as very intrusive, especially in large teams where most people haven't heard of your app nor taken the decision to install it. But it can be suitable for some very specific use cases. Option 2) is the recommended route, but it is hard :-) Good luck!