Configure and migrate service hooks

Overview

You can only manage service hooks in the UI and create custom service hooks if you have the appropriate Sitefinity CMS license. However, if you have configured webhooks before, you can migrate them to service hooks and continue using webhooks by configuring them manually in advanced settings.

Migrate Webhooks to Service hooks 

When you migrate to 14.0 and had webhooks configured previously, they will be automatically migrated to Service hooks when you install the new Servicehooks module. Note that during installation of the Servicehooks module, any existing webhooks will be migrated to Service hooks only if there are no Service hooks created at that point.

When you upgrade to 14.0, if you had any webhooks configured previously they will be automatically migrated to service hooks and will be managed by the Servicehooks module which is installed and enabled by default. Note that after the migration the configured webhooks will not be deleted. If you uninstall the Servicehooks module and then install it again, any existing webhooks will be migrated to service hooks only if there are no service hooks created at that point.

The payload sent by the new service hooks is not the exact same payload sent by the legacy webhooks, which is a breaking change for existing integrations. For sample payloads of service hooks, see List of service hook triggers and sample payload.

Configure service hooks

To create a Service hook, perform the following: 

  1. Navigate to Administration » Settings » Advanced » Servicehook » Servicehook triggers
  2. Click Create new
  3. Enter a Key to distinguish this service hook from other service hooks. 
  4. Enter a Trigger key. For more information on which trigger keys and events are supported, go to List of service hook triggers and sample payload
  5. Enter Event type. For more information of supported event types, go to List of service hook triggers and sample payload.
  6. Click Save changes

Configure the Service hook action in advanced settings 

Next you must configure the service hook action.  

  1. Expand the Service hook trigger you want to configure.
  2. Click Actions » Create new.
  3. Enter the identifier key, GUID, of the service hook action.
  4. Enter a title for the service hook.
  5. Enter an action key. For instance, the web hook action key is servicehookmodule:webhookaction.
  6. Expand the action you just created to add parameters.
  7. Click Create new
  8. In the Key field enter URL.
  9. Add a layer of security using the Secret field and enter a secret that is strong enough.
  10. Sitefinity CMS uses this secret to compute a Hash-based message authentication code (HMAC) of a string in this format: {body_of_request}_{timestamp}.  This is converted to Base64 string. The timestamp is the current Unix timestamp in milliseconds. The hashing algorithm used is SHA256. Sitefinity CMS sends the HMAC as a Sf-Signature header and the timestamp as a Sf-Signature-Timestamp header. 

    IMPORTANT: If you configure a secret, then you must compute the hash on the other side, using the secret and the timestamp, and compare it with the Sf-Signature header. This way you can ensure that the request comes from Sitefinity CMS and can prevent others from sending invalid data to the endpoint. 

  11. In the value field enter the URL of the service that listens for the post request.
  12. Click Save changes

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?