How to use custom field in webhook url

007

Member
Hi all,
How do I use a custom field in a webhook url, like this?

Code:
http://myurl.com/?example-field=[EXAMPLE_FIELD]

I've tested the above url, and mailwizz sends "[EXAMPLE_FIELD]" instead of the value of that field for that user. I'm testing this for the unsubscribe confirmation list page.
 
@007 - Looking through the code it seems we don't parse the tags in the request url, but that should be easily done.
Open /apps/common/extensions/list-form-custom-webhooks/ListFormCustomWebhooksExt.php
and at line 273 you have:
PHP:
try {
    foreach ($webhooks as $webhook) {
        if ($webhook->request_type == ListFormCustomWebhook::REQUEST_TYPE_POST) {
            AppInitHelper::simpleCurlPost($webhook->request_url, $data, 5);
        } elseif ($webhook->request_type == ListFormCustomWebhook::REQUEST_TYPE_GET) {
            $url  = $webhook->request_url;
            $url .= (strpos($url, '?') === false) ? '?' : '&';
            $url .= http_build_query($data, '', '&');
            AppInitHelper::simpleCurlGet($url, 5);
        }
    }
} catch (Exception $e) {}

make it:
PHP:
try {
    foreach ($webhooks as $webhook) {
     $campaign = new Campaign();
     $campaign->customer_id = $list->customer_id;
     $campaign->list_id     = $list->list_id;
   
   
        list(,,$url) = CampaignHelper::parseContent($webhook->request_url, $campaign, $subscriber);
        if ($webhook->request_type == ListFormCustomWebhook::REQUEST_TYPE_POST) {
            AppInitHelper::simpleCurlPost($url, $data, 5);
        } elseif ($webhook->request_type == ListFormCustomWebhook::REQUEST_TYPE_GET) {
            $url .= (strpos($url, '?') === false) ? '?' : '&';
            $url .= http_build_query($data, '', '&');
            AppInitHelper::simpleCurlGet($url, 5);
        }
    }
} catch (Exception $e) {}
That should do it.
 
Back
Top