Configure a HTTP webhook

Webhooks are a premium feature that is not enabled for organizations by default. Make sure you reach out to support@didomi.io to enable this integration before configuring one for your organization.

Introduction

Webhooks allow you to subscribe to events happening on the Didomi platform to implement custom workflows when your users change their consent preferences. When an event is triggered, we'll send a HTTP POST payload to the configured endpoint.

Creating your integration configuration

To configure a HTTP Webhook integration for your organization, send a POST /integrations request with the webhook-http type, a name and a description for your integration, the ID of your organization, and the URL (endpoint) through which the events will be received. By default, HTTP webhook authentication is disabled.

POST https://api.didomi.io/v1/integrations

BODY
{
  "name": "My Webhooks integration",
  "description": "Testing the webhooks integration", 
  "organization_id": "didomi",
  "type_id": "webhook-http",
  "config": {
    "url": "https://api.my-site.com/consents",
    "authentication": {
      "enabled": false
    }
  }
}

Authentication

The HTTP webhook integration supports OAuth as authentication mechanism. To enable it, set the enabled property to true, and the type to oauth. Inside the params property, you can specify the url and the oauth credentials to get a session token (this token will be sent inside the Authorization HTTP header in the event webhook request). The lifetime property defines the lifetime of your session token so a new token can be fetched before the current one expires.

POST https://api.didomi.io/v1/integrations

BODY
{
  "name": "My Webhooks integration",
  "description": "Testing the webhooks integration", 
  "organization_id": "didomi",
  "type_id": "webhook-http",
  "config": {
    "url": "https://api.my-site.com/consents",
    "authentication": {
      // Enabling OAuth
      "enabled": true,
      "type": "oauth",
      "lifetime": 3600,
      "params": {
        "url": "https://api.my-site.com/oauth/token",
        "credentials": {
          "client_id": "***************",
          "client_secret": "******************"
        }
      }
    }
  }
}

This will automatically start sending HTTP POST requests to your configured endpoint whenever a new Didomi event happens and your users consent preferences are updated.

For more information on HTTP webhooks, please visit the Webhooks documentation.

Last updated