Logo
Getting started
    • Overview
    • Authentication
    • Testing
    • Error handling
    • Webhooks
    • Loyalty Tokens
    • Register API
Tutorials
API Reference

Webhooks

For a number of events, you can subscribe to Webhooks to receive event data. Most information concerning the event itself is on the Webhook data. For most related entities, you may only receive its UUID, which then requires an API call to retrieve more data if needed.

A list of available Webhook events can be found below. If there's an event missing, you can request the addition of said event with our support team.


List Webhook Subscriptions

Lists an Account's current Webhook Subscriptions.

GET
https://api.piggy.eu/api//webhook-subscriptions
Headers
Authorization
Bearer {{ access_token | api_key }}
Accept
application/json
Params
event_typestring
OPTIONAL
Only retrieve Webhook Subscription of a specific event type (options: see available webhook event types).
statusstring
OPTIONAL
Only retrieve Webhook Subscription of a specific status (options: ACTIVE, INACTIVE).
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 { "data": [ { "uuid": "f1dc2d67-caa8-4919-a537-66491a94ed2f", "name": "New Krusty Krew Member", "event_type": "contact_created", "url": "http://api.example.com/piggy/webhooks", "status": "ACTIVE", "version": "V1", "created_at": "2023-10-20T11:46:22+00:00" }, { "uuid": "5062eeac-bbeb-4903-b81e-2422793ff151", "name": "Krabby Patty Special Updated", "event_type": "promotion_updated", "url": "http://api.example.com/piggy/webhooks", "status": "ACTIVE", "version": "V1", "created_at": "2023-10-20T11:48:43+00:00" }, { "uuid": "33ee3999-4230-4e3e-b320-cbcbe719bc45", "name": "Friend Brought to Krusty Krab", "event_type": "referral_completed", "url": "http://api.example.com/piggy/webhooks", "status": "INACTIVE", "version": "V1", "created_at": "2023-10-20T11:49:19+00:00" }, ], "meta": [] }

Create Webhook Subscription

Subscribes to a specific Webhook event.

POST
https://api.piggy.eu/api//webhook-subscriptions
Headers
Authorization
Bearer {{ access_token | api_key }}
Accept
application/json

Body

namestring
REQUIRED
A name given to the subscription for internal purposes.
event_typestring
REQUIRED
The event type to listen to, can only choose from available event types.
urlstring
REQUIRED
The endpoint to which webhook data is to be sent.
secretstring
OPTIONAL
The event type to listen to, can only choose from available event types.
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 11 12 { "data": { "uuid": "59165ef0-1afd-4baf-b1f7-ffee287aff32", "name": "New Krusty Krew Member", "event_type": "contact_created", "url": "http://api.example.com/piggy/webhooks", "status": "ACTIVE", "version": "V1", "created_at": "2023-11-13T12:32:43+00:00" }, "meta": [] }

Get Webhook Subscription

Retrieve a specific Webhook Subscription by specifying its UUID.

GET
https://api.piggy.eu/api//webhook-subscriptions/{{webhook_subscription_uuid}}
Headers
Authorization
Bearer {{ access_token | api_key }}
Accept
application/json
Params
webhook_subscription_uuidstring
REQUIRED
The UUID of the Webhook Subscription you want to retrieve.
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 11 12 13 { "data": { "uuid": "59165ef0-1afd-4baf-b1f7-ffee287aff32", "name": "Bikini Bottom Alert", "event_type": "contact_created", "url": "http://yourwebsite.com/somethingsomething", "properties": [], "status": "ACTIVE", "version": "V1", "created_at": "2023-11-13T12:32:43+00:00" }, "meta": [] }

Update Webhook Subscription

Updates an existing Webhook Subscription. The subscription's event_typeand secretcannot be altered after creation.

PUT
https://api.piggy.eu/api//webhook-subscriptions/{{webhook_subscription_uuid}}
Headers
Authorization
Bearer {{ access_token | api_key }}
Accept
application/json
Params
webhook_subscription_uuidstring
REQUIRED
The UUID of the Webhook Subscription you want to update.

Body

namestring
OPTIONAL
A name given to the subscription for internal purposes.
urlstring
OPTIONAL
The endpoint to which webhook data is to be sent.
statusstring
OPTIONAL
The subscription's status (options: ACTIVE, INACTIVE).
attributesarray
REQUIRED | OPTIONAL
Required if event_type is contact_updated, array of one or more contact attributes. Optional when event_type is not contact_updated.
Response Example
Show more
1 2 3 4 5 6 7 8 9 10 11 12 13 { "data": { "uuid": "59165ef0-1afd-4baf-b1f7-ffee287aff32", "name": "Updated Bikini Bottom Alert", "event_type": "contact_created", "url": "http://yourwebsite.com/somethingsomething", "properties": [], "status": "ACTIVE", "version": "V1", "created_at": "2023-11-13T12:32:43+00:00" }, "meta": [] }

Delete Webhook Subscription

Removes an existing Webhook Subscription.

DELETE
https://api.piggy.eu/api//webhook-subscriptions/{{webhook_subscription_uuid}}
Headers
Authorization
Bearer {{ access_token | api_key }}
Accept
application/json
Params
webhook_subscription_uuidstring
REQUIRED
The UUID of the Webhook Subscription you want to delete.
Response Example
Show more
1 2 3 4 { "data": [], "meta": [] }