Webhooks

Purlem uses webhooks to notify your application when PURL visit activity happens in your campaign. Purlem uses HTTPS to send these notifications to your app as a JSON payload. You can then use these notifications to execute actions in your backend systems.

To setup your webhook, go to your campaign settings, scroll down to the webhook section, and enter the full URL of where you would like Purlem to POST activity. (ie. https://yoursite.com/receive)

The script to receive the webhook (located at https://yoursite.com/receive in our example) may look something like this (PHP):

<?php
$payload = @file_get_contents('php://input');
$event = json_decode($payload, true);
//Do something with the event data

Below is an example of the payload you can expect to receive:

{
    "type": "purl.visit",
    "timestamp": "2022-03-15 14:23:30",
    "data": {
        "contact": {
            "id": 239,
            "first_name": "Marty",
            "last_name": "Thomas",
            "email": null,
            "phone": null
        },
        "campaign": {
            "id": 83,
            "name": "Left form"
        },
        "page": {
            "id": 220,
            "name": "Thank You",
            "url": "http://purlem.purlpage.com"
        }
    }
}