Skip to main content

I'm trying to get a webhook up and running so that Microsoft Graph can write straight to a topic on one of my FME Cloud instances. I'm using the following:

 

Go to https://developer.microsoft.com/graph/graph-explorer/, do a POST-request to https://graph.microsoft.com/v1.0/subscriptions using the following body:

{
   "changeType": "created,updated",
   "notificationUrl": "the-topic-url from Message as Subscriber Content",
   "resource": "me/mailFolders('Inbox')/messages",
   "expirationDateTime":"2019-02-15T18:23:45.9356913Z",
   "fmetoken":"token-goes-here"
}

 

However, I get the following response:

 

{
    "error": {
        "code": "InvalidRequest",
        "message": "Subscription validation request failed. Must respond with 200 OK to this request.",
        "innerError": {
            "request-id": "5b842b2b-6325-444e-890e-f9ff6eb61510",
            "date": "2019-02-14T13:09:40"
        }
    }
}

 

Using Postman, I've verified that I get a 202-response if I make a POST-request to the topic URL. Is there another way that I can get a Microsoft Graph webhook up and running? I've seen that there's a web connection for MS Graph, but I don't know if there's any way for me to use that to set up the webhook.

Hi @fhilding

I have done something similar in the past for Microsoft Azure Event Grid. The tricky part setting up these subscriptions with webhooks is the validation of the webhook endpoint. Usually, some kind of token or code is sent to the endpoint and the endpoint needs to echo back this token or code to be successfully validated (https://docs.microsoft.com/en-us/graph/webhooks#notification-endpoint-validation).

FME Server topics cannot issue a response based on a different input, therefore topics cannot be used in this scenario. If you still want to consume notifications with FME Server you need to configure a workspace to act as a webhook that can issue the correct validation response as well as process the payload that you receive in the notification.

I set up an FME Server project that creates a webhook URL that can be used as the notificationUrl in Microsoft Graph Subscriptions. Once the subscription is validated it will send the payload to an FME Server topic that is included in the project. There is also a user included to make things easier, but I highly recommend to change the password of the included user.

I hope this helps!

https://hub.safe.com/projects/gerhardatsafe/microsoft-graphsubscription/versions/1.0.0


Hi @fhilding

I have done something similar in the past for Microsoft Azure Event Grid. The tricky part setting up these subscriptions with webhooks is the validation of the webhook endpoint. Usually, some kind of token or code is sent to the endpoint and the endpoint needs to echo back this token or code to be successfully validated (https://docs.microsoft.com/en-us/graph/webhooks#notification-endpoint-validation).

FME Server topics cannot issue a response based on a different input, therefore topics cannot be used in this scenario. If you still want to consume notifications with FME Server you need to configure a workspace to act as a webhook that can issue the correct validation response as well as process the payload that you receive in the notification.

I set up an FME Server project that creates a webhook URL that can be used as the notificationUrl in Microsoft Graph Subscriptions. Once the subscription is validated it will send the payload to an FME Server topic that is included in the project. There is also a user included to make things easier, but I highly recommend to change the password of the included user.

I hope this helps!

https://hub.safe.com/projects/gerhardatsafe/microsoft-graphsubscription/versions/1.0.0

This looks oh-so-promising. I'll try to find time to play around with it further, thanks a lot :)


Reply