webhook for unsubscribe and bounces

chizzy

New Member
HI, I am looking to find how I can fire a webhook when an email bounces/complain/unsubscribes?

Is this possible?

I have Webhooks enabled in settings -> campaigns ->webhooks and have also installed the cron

I have enabled "List form custom webhooks" in Extensions also.

I go edit list but don't see where i can add the URLs.

I have added to Notifications subscribe/unsubscribe, but i think that is for emails? Well I've put a URL there, manually unsubscribe a user and it didn't work.

Any help would be greatly appreciated.

A
 
I finally found it in the pages section

/page/unsubscribe-confirm

But it's not firing, is it because i am doing it manually?

-- update Seems to only work via the forms. It would be great if i can get a webhook on bounces and complaints

Also, the webhooks do not post json, but key/values, below may assist someone later on..

Code:
$queryString  = file_get_contents('php://input');
// Split the string into individual key-value pairs
$keyValuePairs = explode('&', $queryString);

$dataArray = [];

foreach ($keyValuePairs as $keyValuePair) {
    list($key, $value) = explode('=', $keyValuePair, 2);

    // Replace "+" with space and decode URL-encoded value
    $key = urldecode($key);
    $value = urldecode($value);

    // Convert nested keys into an array structure
    $keys = explode('[', str_replace(']', '', $key));
    $targetArray = &$dataArray;

    foreach ($keys as $keyPart) {
        if (!isset($targetArray[$keyPart])) {
            $targetArray[$keyPart] = [];
        }
        $targetArray = &$targetArray[$keyPart];
    }

    // Assign the value to the final nested key
    $targetArray = $value;
}

// Now $dataArray contains the parsed data
print_r(json_encode($dataArray));
 
Last edited:
Back
Top