Within Zephr you have the ability to use Webhooks to send third-party applications real-time information. Webhooks allow you to integrate with products that do not have a Zephr plugin. Webhooks are commonly used to add a user to a mailing list, note in a CRM when a User hits a Paywall, or trigger automated marketing emails.
Adding a Webhook in Zephr is easy. You will need to know when you want to trigger the Webhook, as well as the Target End Point URL, which is where the information held within the Webhook should be sent.
To begin, navigate to Settings > Webhooks within the Zephr Admin Console. This will take you to a list of your current Webhooks. Click Add A Webhook.
Configuring a Webhook
Given you Webhook a title, then select the Webhook Type.
System Webhooks will be triggered by System events happening within Zephr. Rule Webhook will allow you to trigger a Webhook within a Zephr Feature Rule.
When selecting the System Webhook Type, the following triggers are available. You can choose as many system triggers as you need, by toggling them on in the configuration set up:
User
- Create
- Delete
- Update
- Update Email
- Update extended profile
- Delete extended profile
- Create session (includes anonymous)
- Create tracking id
- Login
- Create session breach (for concurrent sessions)
- Verifies Email
- Remove from Account
- Add to Account
Data Retention
- Inactivity delete
Entitlement
- Grant
- Grant started
- Grant ended
Account
- Grant
- Grant started
- Grant ended
Decision
- Access
Once you have completed the Type configuration, select the Method – either GET, POST, PUT, or DELETE
For Target, enter the Endpoint Target URL for the system you are integrating with. For more information, check the help desk of the system you’re integrating with to find out how to listen for Webhooks.
Following this, click Add Sites to set which of your sites the webhook will be used on. If you haven’t set up your Zephr sites yet, take a look at our Sites guide.
Once the fields are complete, click Save.
Once added, the Webhooks you create will fire whenever the trigger criteria you have set is met within Zephr, or, if you’ve selected the Rule Webhook, can be used within your Zephr Feature Rules. Once the Webhook has been created and saved, follow our guide for adding a Webhook to a Feature Rule to learn how to trigger it.
Keep reading for more information on the different Webhook triggers and their payloads.
User – Create
The “User created” event fires every time a new user is created, either through registration or directly in the Admin Console / Admin API.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "CREATE_USER", "time": 1592181105400, "details": { "user_id": "ce219f64-59e2-46a5-ba5f-6dc8a0b31397", "identifiers": { "email_address": "gwen@zephr.com" }, "attributes": { "first-name": "Gwen", "last-name": "Doline" }, "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "email_verified": false, "tracking_id": "e55fc897-be62-491e-93c3-ff11f7ae6274", "registered": "2020-06-15T00:31:44Z", "registration_state": "complete" }, "webhook": "<webhookLabel>" }
User – Delete
The “User deleted” event fires every time a user is deleted, either through the “forget me” API or directly in the Admin Console / Admin API.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "DELETE_USER", "time": 1592181015931, "details": { "user_id": "18a9db94-b071-4ad5-984c-b9147eb8592c", "identifiers": { "email_address": "<gwen@zephr.com>" }, "attributes": {}, "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "email_verified": false, "tracking_id": "517c8da0-8b2b-4236-8569-975f3f9b00b5", "registered": "2020-06-14T23:48:07Z", "registration_state": "complete" }, "webhook": "<webhookLabel>" }
User – Update
The “User updated” event fires every time a user changes their core profile, either through the Public API or directly in the Admin Console / Admin API.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "UPDATE_USER_PROFILE", "time": 1592181166671, "details": { "user_id": "ce219f64-59e2-46a5-ba5f-6dc8a0b31397", "identifiers": { "email_address": "gwen@zephr.com" }, "attributes": { "gender": "Female", "first-name": "Gwen", "last-name": "Doline" }, "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "email_verified": false, "tracking_id": "e55fc897-be62-491e-93c3-ff11f7ae6274", "registered": "2020-06-15T00:31:45Z", "registration_state": "complete" }, "webhook": "<webhookLabel>" }
User – Update Email
The “User Update Email” event fires every time a user updates their email address.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "tenantId", "subTenantId": "subTenantId", "type": "UPDATE_USER_EMAIL", "time": 1613531371288, "details": { "previous_identifiers": { "email_address": "<oldeEmailAddress>" }, "identifiers": { "email_address": "<newEmailAddress>" }, "tracking_id": "7b8c3eb2-370b-41f9-883b-07d01de3f0aa" }, "webhook": "<webhookLabel>" }
User – Update Extended Profile
The “User’s extended profile updated” event fires every time a user changes one of their extended profile documents.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId":"tenantID", "subTenantId":"subTenantId", "type":"UPDATE_USER_EXTENDED_PROFILE", "time":1597152876607, "details":{ "user_id":"3e2b1d9d-e994-4c6a-9c57-bddee6f2a770", "identifiers":{ "email_address":"test@zephr.com" }, "test1":"{ "identifiers":{ "email_address":"test@zephr.com" }, "validators":{ "password":"Test123" } }" }, "webhook":"webhookLabel" }
User – Delete Extended Profile
The “User’s extended profile deleted” event fires every time a user deletes their extended profile documents.
Any Webhooks registered to this event will send out the following payload:
User – Create Session
The “User Create Session” event fires when a session is created, including an anonymous session.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "SESSION_CREATE", "time": 1592178686326, "details": { "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "supplied": false, "expiryDate": "2021-06-14 23:51 PM UTC", "startDate": "2020-06-14 23:51 PM UTC", "authenticated": true, "state": "authenticated", "device": "pc", "browser": "Chrome", "os": "Mac OSX", "city": "Dublin", "immutable": true, "session_id": "c6d00245-61ce-43e7-be93-edff8ae06906", "user_id": "0747c739-e758-4908-896d-d5734e0e3e09" }, "webhook": "<webhookLabel>" }
User – Login
The “User login” event fires every time a user logs in.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "LOGIN_USER", "time": 1592181272022, "details": { "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "supplied": false, "expiryDate": "2021-06-15 00:34 AM UTC", "startDate": "2020-06-15 00:34 AM UTC", "authenticated": true, "state": "authenticated", "device": "pc", "browser": "Chrome", "os": "Mac OSX", "city": "Dublin", "immutable": true, "session_id": "c3382226-4db6-4259-8e2a-425518e2c3ba", "user_id": "8bd85938-80dc-48a7-a1d9-f42e4040b3ef" }, "webhook": "<webhookLabel>" }
User – Current Session Breach
The “User Current Session Breach” event fires when a user breaches their concurrent session limit (and thus is logged out of a previous session). Read our Restrict Account Sharing guide for more details.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "CONCURRENT_SESSIONS_BREACH", "time": 1592179087683, "details": { "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "supplied": false, "expiryDate": "2021-06-14 23:57 PM UTC", "startDate": "2020-06-14 23:57 PM UTC", "authenticated": true, "state": "authenticated", "device": "pc", "browser": "Chrome", "os": "Mac OSX", "city": "Dublin", "immutable": true, "session_id": "07732a63-fcbc-4c34-8d44-54fb7bc846aa", "user_id": "7010a889-abf5-49ca-9141-b78ce2d540c7" }, "webhook": "<webhookLabel>" }
User – Verifies Email
This webhook is sent at the point that a User verifies their email if you require email verification upon registration within Zephr.
{ "tenantId":"<tenantId>", "subTenantId":"<subTenantId>", "type":"VERIFY_EMAIL", "time":157175564639, "details":{ "tenantId":"<tenantId>", "subTenantId":"<subTenantId>", "user_id":"60e15477-c22d-4905-b79a-30c14d3e27fe" }, "webhook":"<webhookLabel>" }
User – Remove From Account
This webhook is sent at the point a user is removed from a corporate account.
{ "tenantId": "tenantId", "subTenantId": "subTenantId", "type": "ACCOUNT_USER_DELETED", "time": 1613532249016, "details": { "accountUser": { "user_id": "c48a790d-26d7-46b0-bbde-cdb0d46574b8", "identifiers": { "email_address": "<emailAddress>" }, "attributes": {}, "tenantId": "<tenantId>", "subTenantId": "<subTenantId", "email_verified": false, "tracking_id": "7b8c3eb2-370b-41f9-883b-07d01de3f0aa", "registered": "2021-02-17T02:27:54Z", "registration_state": "complete", "registration_tenant": "<registrationTenant" }, "currentNumberOfUsers": 3 }, "webhook": "<webhookLabel>" }
User – Add To Account
This webhook is sent at the point a user is added to a corporate account.
{ "tenantId": "tenantId", "subTenantId": "subTenantId", "type": "ACCOUNT_USER_CREATED", "time": 1613532273008, "details": { "accountUser": { "user_id": "c48a790d-26d7-46b0-bbde-cdb0d46574b8", "identifiers": { "email_address": "<emailAddress>" }, "attributes": {}, "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "email_verified": false, "tracking_id": "7b8c3eb2-370b-41f9-883b-07d01de3f0aa", "registered": "2021-02-17T02:27:54Z", "registration_state": "complete", "registration_tenant": "<registrationTenant>" }, "currentNumberOfUsers": 4 }, "webhook": "<webhookLabel>" }
Data Retention – Inactivity Delete
The “Users deleted due to inactivity” event fires periodically and reports all users that have been deleted from the system due to inactivity since their last session.
Any Webhooks registered to this event will send out the following payload:
{ "type": "users.inactivity.deletion", "time": "2012341542354", // long - milliseconds since epoc "details": [ { "user_id": "b23402bc4-fc8f8c99-9034298423482", "identifiers": { "email_address": "x@y.co" }, "attributes": { "foo": "bar" // based upon configured user schema } "email_verified": true, "last_login": "yyyy-MM-dd HH:mm:ss" } ] }
Entitlement – Grant
The “Entitlement granted” event fires every time an entitlement is granted to a user, either by purchasing a product or by direct grant via the Admin Console / Admin API.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "ENTITLEMENT_GRANT", "time": 1592181363055, "details": { "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "grant_id": "8f3b3d92-0fc8-45db-86a3-118474908eca", "user_id": "ce219f64-59e2-46a5-ba5f-6dc8a0b31397", "expiry_state": "active", "entitlement_type": "entitlement", "entitlement_id": "1d405fbd-38ec-47a7-bb83-d185d8738550", "product_id": null, "test_groups": {} }, "webhook": "<webhookLabel>" }
Entitlement – Grant Started
The “Entitlement Grant Started” event fires every time an entitlement is granted to a user, either by purchasing a product or by direct grant via the Admin Console / Admin API.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "GRANT_STARTED", "time": 1592180693787, "details": { "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "grant_id": "f4b88efd-6573-411d-b4b8-b776a6f5ecfa", "user_id": "8bd85938-80dc-48a7-a1d9-f42e4040b3ef", "expiry_state": null, "entitlement_type": "entitlement", "entitlement_id": "1d405fbd-38ec-47a7-bb83-d185d8738550", "product_id": null }, "webhook": "<webhookLabel>" }
Entitlement – Grant Ended
The “Entitlement Grant Ended” event fires every time an entitlement is removed/revoked for a user, either automatically (via grant expiry) or via the Admin Console / Admin API.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "GRANT_ENDED", "time": 1592180824040, "details": { "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "grant_id": "f4b88efd-6573-411d-b4b8-b776a6f5ecfa", "user_id": "8bd85938-80dc-48a7-a1d9-f42e4040b3ef", "expiry_state": "active", "entitlement_type": "entitlement", "entitlement_id": "1d405fbd-38ec-47a7-bb83-d185d8738550", "product_id": null }, "webhook": "<webhookLabel>" }
Decision – Access
The “Access decision made” event fires every time there is a challenge made for access. This is usually an internal mechanism but the Webhook exposes the challenge and response in the form a mapping between required entitlements and whether or not the user was entitled to them.
Any Webhooks registered to this event will send out the following payload:
{ "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "type": "ACCESS_DECISION", "time": 1592181497049, "details": { "accessDecisions": {}, "meterChanges": {}, "creditChanges": {}, "newOrUpdatedCrossDeviceSession": { "tenantId": "<tenantId>", "subTenantId": "<subTenantId>", "authenticated": false, "v": 0, "session_variables": {}, "user_id": "212917da-10fc-4b65-9fed-1198770c0796", "sessions": [], "access_model": { "meters": {}, "credits": {}, "delivered_entitlements": [], "granted_bundles": [], "jwt_bundles": [] }, "last_updated": null, "test_groups": { "registration-test": "A" }, "second_party_data": {} }, "updatedAccessModel": { "meters": {}, "credits": {}, "delivered_entitlements": [], "granted_bundles": [], "jwt_bundles": [] } }, "webhook": "<webhookLabel>" }
Rule Webhook
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>" }