Recipients

Each Marketing Program has its own Recipients. Piggy Merchants can sync their Marketing Programs with their Loyalty Programs in their Business Dashboard, such that for every new Member in the synced Loyalty Program, a Recipient is created in the Marketing Program. A Recipient is, in its basis, not much more than an email address linked to a Marketing Program. However, much more information can be added to Recipients, using Custom Attributes.

Custom Attributes

Piggy Merchants choose the properties their Members and Recipients can have, so first, they need to be created in the Business Dashboard. Before building an integration in which Custom Attributes play any role, please read up on the them here.

Formatting

Format the Custom Attributes in the body of a PUT call as follows:

{ "custom_attributes": { "name": "John Doe", "numberOfPets": 2, "favouriteAnimal": "Dog", "ownsAnimals": [ "Dog", "Fish" ], "birthDay": "1980-01-23", "firstVisit": "2021-03-11T16:30:30+00:00" } }

Find Marketing Program Recipient by Email Address

Retrieve a Recipient's information and their Custom Attributes for this Marketing Program, if any custom attributes are set on the Marketing Program.

GETFind Recipient by Email Address

https://api.piggy.nl/api//marketing-recipients?email={{email}}&marketing_program_id={{id}}

HEADERS

AuthorizationBearer {{ api_key }}

PARAMETERS

emailstring
REQUIREDThe Recipient's email address
marketing_program_idnumber
REQUIREDThe Marketing Program's ID

Code

Message

7002
Account inactive.
55004
Marketing program not found.
1003
Invalid input.
55020
Marketing recipient not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "data": { "id": 1, "email": "member@piggy.eu", "custom_attributes": [ "firstName": "John", "lastName": "Doe", "birthDate": "1965-10-25", "creditBalance": 125, "lastVisit": "2021-02-28T10:05:34+00:00" ], "is_subscribed": true, "created_at": "2021-01-15T10:00:00+00:00" } }
1 2 3 4 5 6 7 8 9 { "data": { "id": 1, "email": "member@piggy.eu", "custom_attributes": null, "is_subscribed": true, "created_at": "2021-01-15T10:00:00+00:00" } }


Create Marketing Program Recipient

Creates a Recipient for a certain Marketing Program. Use the Update Recipient API call to set Custom Attributes for the Recipient.

POSTCreate Recipient

https://api.piggy.nl/api//marketing-recipients

HEADERS

AuthorizationBearer {{ api_key }}

BODY

emailstring
REQUIREDThe email address with which the Recipient is to be registered
marketing_program_idnumber
REQUIREDThe Marketing Program's ID

Code

Message

7002
Account inactive.
55004
Marketing program not found.
1003
Invalid input.
55005
Marketing program customer already exists.
1 2 3 4 5 6 7 8 9 { "data": { "id": 1, "email": "member@piggy.eu", "custom_attributes": [], "is_subscribed": true, "created_at": "2021-01-15T10:00:00+00:00" } }

Update Marketing Program Recipient

Sets the Custom Attributes for the Recipient. Note: the Custom Attributes to be set, must already be created in the Business Dashboard. Also, make sure the Custom Attribute Name and Type match before updating. You might either get an error (in case the type is incorrect) or the Custom Attribute simply won't be set (in case the name is incorrect).

For an overview of all Custom Attributes data types, click here.

PUTUpdate Recipient

https://api.piggy.nl/api//marketing-recipients/{recipient_id}

HEADERS

AuthorizationBearer {{ api_key }}

PARAMETERS

recipient_idnumber
REQUIREDThe Recipient's ID.

BODY

custom_attributesarray
OPTIONALArray of all Custom Attributes to be set. Use the formatting as mentioned above.
is_subscribedboolean
OPTIONALNew subscribed status of the recipient. Only 'true' or 'false' is accepted here.

Code

Message

7002
Account inactive.
55004
Marketing program not found.
1003
Invalid input.
55020
Marketing recipient not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "data": { "id": 1, "email": "member@piggy.eu", "custom_attributes": [ "firstName": "John", "lastName": "Doe", "birthDate": "1965-10-25", "creditBalance": 125, "lastVisit": "2021-02-28T10:05:34+00:00" ], "is_subscribed": true, "created_at": "2021-01-15T10:00:00+00:00" } }

Related