I'm using Microsoft Graph Webhooks to get notifications when an event happens.
My application shows the user his next meeting. On refresh the next meeting is displayed on the screen. To update the next meeting I would like to receive a notification of the start of the next meeting. Is there a way to achieve this with Microsoft Graph Webhooks?
To get the events of the user you would normally make a request like this
{
"changeType": "created,updated",
"notificationUrl":
"https://webhook.azurewebsites.net/api/send/myNotifyClient",
"resource": "me/events",
"expirationDateTime":"2016-11-20T18:23:45.9356913Z",
"clientState": "subscription-identifier"
}
Webhooks are only intended to notify you of changes to the data itself. How your application handles that data (i.e. denoting when the start time is) is entirely outside of the API's scope.
Related
While integrating onlinemeeting schedule api using microsoft graph
schedule api https://graph.microsoft.com/v1.0/me/onlineMeetings
Used to call api using token generated from https://login.microsoftonline.com/tenant id/oauth2/v2.0/token
Getting below response but its working fine in https://developer.microsoft.com/en-us/graph/graph-explorer
{
"error": {
"code": "Forbidden",
"message": "",
"innerError": {
"request-id": "b0a472d0-1658-480b-b41f-855bbe87b705",
"date": "2021-05-12T18:55:15",
"client-request-id": "b0a472d0-1658-480b-b41f-855bbe87b705"
}
}
}
As already stated, you’ll need to have the global admin execute some powershell to activate your application to allow to create online meetings for all/some users.
I’m just wondering what your use case is, for creating just the online meeting without a calendar event?
You can just do the same by creating an event in the users’ calendar and setting that you want an online meeting attached. That way only needs access to the users calendar and doesn’t need some special policy. Additionally the item with join button is right there in the users calendar.
I'm trying to develop a bot to be used exclusively for proactive messaging (since unfortunately, it appears Connectors do not support direct messaging). I stood up a web service, and was able to receive the payload from Teams when I sent a message to the bot.
I'm now trying to send a proactive message from the bot back to my user, as described here. Per the instructions, I am POSTing the following payload to <serviceUrl>/v3/conversations. (Values in brackets are interpolated from the payload I received from Teams)
{
"bot": {
"id": <recipient.id>,
"name": <recipient.name>
},
"isGroup": false,
"members": [
{
"id": <from.id>,
"name": <from.name>
}
],
"tenantId": <channelData.tenant.id>,
"topicName": "News Alert"
}
I also included a Bearer token that I got by calling https://login.microsoftonline.com/<channelData.tenant.id>/oauth2/v2.0/token. Yet, whenever I try to create the conversation, it fails with an error that "Authorization has been denied for this request." As far as I can tell, the token should be valid, so I'm not sure what else could be going on here. I saw something about trusting the service URL, but I'm not sure how I would do that since I'm not using the Bot SDK. Perhaps I'm going about this wrong and should be trying to create an Activity rather than a Conversation?
There are basically two steps in sending pro-active messages. The first step is just a once-off - it's getting the unique ID of the conversation between the bot and the user. It's the paragraph you're linking to in your original question, and it's the payload sample you're showing. Once you've got that conversation id, you'd then proceed to sending messages at any time in the future (that's this paragraph).
However, in Teams, the first part is handled differently. Rather than calling the bot framework conversation endpoint (recall that bot framework is used for other things aside from Teams bots), you wait for the user to install the app, which includes your bot. When this is done, your bot will receive a conversationUpdate event. When this fires, you'll be sent a payload which includes the conversationId of the newly-created conversation. This replaces the call you're currently making.
You need to save the conversationId, and the serviceUrl (which will be similar too 'https://smba.trafficmanager.net/apis', but unique for Teams, and will be the 'base' of the URL you'll call later).
Importantly, it is possible to "pre-install" an app for a user, using the Graph API. See Install app for user.
That should help with what you're missing. However, as an 'fyi', you can use libraries for this instead of making the call directly yourself. In dotnet, for instance, you can reference Microsoft.Bot.Connector.ConnectorClient (in Microsoft.Bot.Connector), which has a Conversations.SendToConversationAsync(..) method.
I think I've figured out the problem. I sent my token request to https://login.microsoftonline.com/<channelData.tenant.id>/oauth2/v2.0/token, which was successful and gave me a token back. However, the instructions outlined here say not to use <channelData.tenant.id>, but instead just the hardcoded string botframework.com. After requesting the token that way, my requests appear to be working.
I'm interested to use webhook to notify me when a user was added/removed from a Team on Microsoft Teams.
But do not create a subscription for each team I prefer to enter in the filter the team that I am interested in being notified.
So I used this Request:
POST https://graph.microsoft.com/v1.0/subscriptions
{
"resource": "groups?$filter=mail eq 'someGroupmail#domain.com' or 'ohterGroupMail#domain.com'",
"changeType": "updated",
"clientState": "1234",
"notificationUrl": "https://1234.ngrok.io/xxxxx",
"expirationDateTime": "2019-01-05T12:21:25Z"
}
The subscription was successful created (receive response 200-OK), but I noticed that I received notifications even on the groups not being in the filter, I have the impression that the filter is not taken into account.
There is no way to create a subscription on multiple groups in one request?
Filtering expressions are not yet supported by Microsoft Graph notifications. You can subscribe to changes on the entire resource collection ("resource": "groups") or you can create a subscription for a single group ("resource": "groups/"). The latter will result in changes for that group only.
I am attempting to open a DM (Direct Message) with an arbitrary user using the im.open Slack API call. I am sending it a user's user_id that I obtain through their clicking of a consent button in order to begin a series of questions. I am sending data to the Slack API successfully along with receiving data. I am getting the following response...
{
"ok": false,
"error": "missing_scope",
"needed": "im:write",
"provided": "identify,incoming-webhook,chat:write:user,files:write:user",
}
I have went into the application's page and changed the scope of the app (I am not the owner, but have been given collaborator permissions by my team lead (the owner)). These are the current permissions...
I apologize for the poor quality of the image. The scopes are as follows...
identify
incoming-webhook
chat:write:user
files:write:user
im:write
After this change, I am still getting the same response from the Slack API. The following is what I am sending them (it's my user_id, and I don't mind).
{
"user": "U94155Z43"
}
Any help is appreciated. Thanks.
I needed to use the bot token "xoxb" instead of the user token "xoxp" which I had used for all other slack api calls.
I am integrating Outlook Office 365 in my web app. I want my app to remain in sync with Office 365 if there is any create/update event in the calendar.
Currently I have created one-way sync process, like create, update, delete, and get all events from calendar. The problems are:
how to make two-way syncing with Office 365 for our app?
How to create notification subscription?
how to authenticate Notification-URL for subscription?
When we subscribe for notification callback, the returned message through exception with this Notification URL
https://webapp.com/notifications?validationtoken=MmJiM2QwMjYtNjAxYi verification failed.
The question is how we will verify Notification-ULR?
I have created app on Window Azure and when i subscribe return same error message.
How i fix this?
Following code for subscription:
URL: https://outlook.office365.com/api/v2.0/me/subscriptions
json_object = {
"#odata.type":"#Microsoft.OutlookServices.PushSubscription",
"Resource":"https://outlook.office365.com/api/v2.0/Me/Events",
"NotificationURL":"https://webapp.com/notifications“,
"ChangeType":"Created, Updated, Deleted",
"ClientState":"36228645-58b5-4d73-98a6-1b9ac535680c"
}
https://dev.outlook.com/RestGettingStarted/Concepts/Webhooks
The Outlook notifications service validates the notification URL in a subscription request before creating a new subscription which occurs as follows:
Outlook notifications service sends a POST to the notification URL:
POST https://{notificationUrl}?validationtoken={TokenDefinedByService}
ClientState: {Data sent in ClientState value in subscription request (if any)}
Webhooks service must provide a 200 response with the validationtoken value in its body as type plain/text within 5 seconds. The validation token is a random string that should be discarded by the webhook after providing it in the response.