Zephr User Guide

Rule Webhooks

35 views 0

When creating a Webhook in Zephr, there are two types of Webhook that you can create.

System Webhooks are triggered automatically by system events happening within Zephr.

Rule Webhooks allow you to specify at which point within a rule a Webhook is triggered.

This guide looks specifically a Rule Webhooks and discusses:

  • How to trigger a Rule Webhook
  • The Rule Webhook payload

Triggering a Webhook within a Rule

Firstly, you will need to have a Rule Webhook configured within your Webhooks section. If you have no yet created one, follow our Webhooks guide for more details.

Once your Webhook is created, navigate to the Feature or Redirect Rule you wish to trigger the Webhook in.

On your Rules Palette, locate the Integrations Tab and drag the Webhook node onto your canvas.

Rule Webhooks - Integrations Tab Select the Webhook you wish to trigger from the dropdown menu.

Rule Webhooks - Selecting a Webhook

Once the Webhook has been selected, connect the node to the rest of your rule as required.

Rule Webhooks - Completed Rule Example

In the rule above, all Anonymous Users who are visiting a site on a Mobile device will trigger a Rule Webhook.

Rule Webhook Payload

Webhooks that are set to the Rule Type will trigger based upon the point they have been situated in a rule. The payload looks as follows:

{
  "tenantId": "<tenantId>",
  "subTenantId": "<subTenantId>",
  "type": "FEATURE_CUSTOM",
  "time": 1613536094188,
  "details": {
    "user_id": "fd4b91fb-2231-4f27-8a1d-701741dedf5a",
    "authenticated": false,
    "access_model": {
      "meters": {},
      "credits": {},
      "delivered_entitlements": [],
      "granted_bundles": [],
      "jwt_bundles": [],
      "user_state": "anonymous"
    },
    "content_uri": "<contentUri>",
    "feature_name": "<featureName>"
  },
  "webhook": "<webhookLabel>"
}