Skip to main content
Solved

Microsoft Graph Webhook to FME Server Topic

  • February 14, 2019
  • 2 replies
  • 41 views

Forum|alt.badge.img+1

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.

Best answer by gerhardatsafe

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 post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

Forum|alt.badge.img
  • 288 replies
  • Best Answer
  • February 16, 2019

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


Forum|alt.badge.img+1
  • Author
  • 56 replies
  • February 20, 2019

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 :)