Maropost for Marketing supports Webhooks in two areas of the application:
- Accounts
- Contact Lists
Webhook Integration in Accounts
You can integrate webhooks in your account-level setting to get notified of any changes to the contacts. On the ACCOUNT tab of the Account Settings page, you can specify a webhook in the HTTP POST URL field.
The webhook is fired whenever a new contact is added or an existing one is modified or deleted in the system. All the details of the new/updated contact (default and custom fields) are sent in a JSON-formatted payload to the API endpoint that you specify in the field.
If a default field of any contact is updated, the changed attribute information in the payload includes the field that was updated along with the date and time on which it was updated. However, if a custom field of any contact is updated, the changed attribute information in the payload includes only the date and time on which the field was updated.
📋 Note: The webhook does not fire when you update the tags for the contacts.
The following is an example of the JSON payload that was sent after the default fields first_name and last_name were updated for a contact:
{ "subscriptions": [ { "list_id": 1169, "list": "Test_12312", "status": "Hard-Bounced" } ], "changed_attributed": { "first_name": "Friend", "last_name": "", "updated_at": "2020-07-22T16:34:02.000Z" }, "contact": { "1234": "abc", "id": 12133221, "account_id": 1000, "email": "vidushi.sood123@hotmail.com", "first_name": "Sam", "last_name": "Jones", "domain_name_id": 11, "created_at": "2020-07-22T12:34:01.000-04:00", "updated_at": "2020-10-08T10:40:17.000-04:00", "age": null, "language": "english", "favourite_colour": null, "vacation_spot": null, "shirt_size": null, "custom_field_001": false, }, "tags": [] }
Webhook Integration in Contact Lists
You can integrate webhooks in your lists to get notified of any changes to the subscription status of contacts in the lists. The webhook is fired when a contact is added to the list and also when the subscription status of contacts within the list changes.
When creating a new list or editing an existing list, enter the webhook API endpoint in the Post URL field.
The following is an example of the JSON payload that was sent after a contact subscribed to the list:
{ "subscriptions": [ { "list_id": 1248, "list": "tester sk", "status": "Subscribed" }, { "list_id": 1275, "list": "sk test list", "status": "Subscribed" } ], "changed_attributed": { "id": 12944266, "account_id": 1000, "list_id": 1275, "contact_id": 12407494, "active": true, "status": 0, "created_at": "2020-10-08T11:58:11.000-04:00", "updated_at": "2020-10-08T11:58:11.000-04:00" }, "status_code": 0, "active": true, "list": "sk test list", "list_id": 1275, "status": "Subscribed", "contact": { "1234": "abc", "id": 12407494, "account_id": 1000, "email": "sonakshi@yopmail.com", "first_name": "Maropost", "last_name": "", "domain_name_id": 8924, "created_at": "2020-10-08T06:58:38.000-04:00", "updated_at": "2020-10-08T06:58:41.000-04:00", "age": null, "language": "english", "favourite_colour": null, "vacation_spot": null, "shirt_size": "Free Size", "custom_field_001": false, }, "tags": [] }
Ensuring Security When Using Webhooks
By default, Maropost does not include any authentication token in its webhook callbacks to your API endpoint. If you want to ensure stronger security, you can create a JSON Web Token that will then be included in all your webhook callbacks. The JSON Web Token can be created on the Connections page. For more information on JSON Web Token and steps to create it, see JSON Web Token (JWT) Authentication.