Skip to main content
Best answer

Anyone have success with MS Graph Webhook Subscriptions for triggering on contact updates?

  • August 13, 2021
  • 1 reply
  • 1191 views

Mercology
Forum|alt.badge.img+5

I need a Zap that will be notified when a MS Contact is updated...Unfortunately, there is not a Zap to do this.  SO...I researched MS Graph API and creating subscriptions for this type of notifications.  It looks just like a RestHooks subscription with Create and Delete subscription methods.

I am curious if anyone has tried this?  If so, any guidance before I dive in?

Here’s a tutorial if anyone is interested: https://docs.microsoft.com/en-us/learn/modules/msgraph-changenotifications-trackchanges/4-change-notifications

Thanks in advance.

Best answer by ikbelkirasan

Hi @Mercology - I think it would better to implement this in a custom Zapier integration. Using a Hook trigger enables you to:

  1. Call an endpoint to create a subscription when the zap is turned on and the subscription ID will be stored. (In this case, it would be: POST https://graph.microsoft.com/v1.0/subscriptions)
  2. Call another endpoint to unsubscribe when it’s turned off (DELETE https://graph.microsoft.com/v1.0/subscriptions/{subscription_id} ).

It looks like this API requires renewing the subscriptions from time to time. To achieve that, you might want to add another trigger (it would be a polling trigger in this case) to check if the subscription expired and when that happens, it should call this endpoint: PATCH https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}

Tip: This subscription_id might not be accessible from this second trigger so you should store it in Zapier Storage for example when you create the subscription in order to be able to fetch it when the polling trigger runs.

I hope this helps.

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Expert
  • 555 replies
  • Answer
  • August 13, 2021

Hi @Mercology - I think it would better to implement this in a custom Zapier integration. Using a Hook trigger enables you to:

  1. Call an endpoint to create a subscription when the zap is turned on and the subscription ID will be stored. (In this case, it would be: POST https://graph.microsoft.com/v1.0/subscriptions)
  2. Call another endpoint to unsubscribe when it’s turned off (DELETE https://graph.microsoft.com/v1.0/subscriptions/{subscription_id} ).

It looks like this API requires renewing the subscriptions from time to time. To achieve that, you might want to add another trigger (it would be a polling trigger in this case) to check if the subscription expired and when that happens, it should call this endpoint: PATCH https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}

Tip: This subscription_id might not be accessible from this second trigger so you should store it in Zapier Storage for example when you create the subscription in order to be able to fetch it when the polling trigger runs.

I hope this helps.