WebHooks in Microsoft Dynamics 365

This post will be helpful for those who already have some idea about the use of service end point in Dynamics CRM/365.

What is WebHooks?

WebHooks is a lightweight HTTP pattern for connecting Web APIs and services with a publish/subscribe model. Webhook senders notify receivers about events by making requests to receiver endpoints with some information about the events.

A WebHooks is a way for an app to provide other applications with real-time information.

A WebHooks delivers data to other applications as it happens, meaning you get data immediately. Unlike typical APIs where you would need to poll for data very frequently in order to get it real-time. This makes web hooks much more efficient for both provider and consumer.
For more detail about WebHooks please visit WebHooks

Use of WebHooks in Dynamics 365

Webhooks enable developers and Independent service vendor’s to integrate Dynamics 365 data with their own custom code hosted on external services. By using the webhook model, you can secure your endpoint by using authentication header or query string parameter keys. This is simpler Azure Service Bus integration, you may currently using.

19-1

For more detail about Azure Service Bus integration please visit Azure Service Bus integration

  • Azure Service Bus works for high scale processing, and provides a full queueing mechanism if Dynamics 365 is pushing many events.
  • Webhooks can only scale to the point at which your hosted web service can handle the messages.
  • Webhooks enables synchronous and asynchronous steps. Azure Service Bus only allows for asynchronous steps.
  • Webhooks send POST requests with JSON payload and can be consumed by any programming language or web application hosted anywhere.
  • Both WebHooks and Azure Service Bus can be invoked from a plugin or custom workflow activity.
  • Steps to use of WebHooks in Dynamics 365

      1. Register a webhook

    Use the Plug-in Registration tool to register a webhook. In version 9.x you will get a new option “Register New Web Hook”.
    19-2

    19-3

    19-4

    The correct webhook registration authentication option and values to use depend on what the endpoint expects. The owner of the endpoint must tell you what to use. To use WebHooks with Dynamics 365, the endpoint must allow one of the three authentication options

    19-5

    Webhook registrations are stored in the ServiceEndpoint Entity in dynamics 365 with contract value equal to 8.

      2. Register a step for a webhooks

    You can register steps same as plugin registration step, only difference will be you cannot pass any configuration. Both configuration field (secure and unsecure) will be disable.

    19-6

    19-7

      3. Invoke a webhooks from a plugin or workflow activity

    Webhook is a kind of service endpoint you can also invoke it without registering a step with a plug-in or workflow activity in the same way you can for an Azure Service Bus endpoint. You need to provide the ServiceEndpointId to the IServiceEndpointNotificationService interface

    Plugin Sample to invoke WebHooks

    19-8

    Workflow sample to invoke WebHooks

    19-9

    feel free to contact me in case of any query or help.

    Send me your queries at arif.manit@gmail.com

    Leave a comment