webhooks question

d3m0n

Member
Hello,

I know about Mailwizz ability to send webhooks when campaigns or link is opened.
Are there any other webhooks that we can address?
I want to send a POST request to our CRM every time a user is registered containing name and email.
What controller can be used in the registration form / process to capture the data?
What is the best way to do this ?

any tips or reference manuals are very helpful
thx
 

twisted1919

Administrator
Staff member
User customer from the registration form
Gotcha. Unfortunately, we don't have any direct hook there yet, so your best bet would be to connect to the 'controller_action_save_data' action hook:
Code:
Yii::app()->hooks->addAction('controller_action_save_data', function(CAttributeCollection $collection) {

if ($collection->itemAt('controller')->getRoute() != 'guest/register') {
     return;
}
    
if (!$collection->itemAt('success')) {
    return;
}

/** @var Customer $model */
$customer = $collection->itemAt('model');

if (!$customer->validate()) {
    return;
}

if (EmailBlacklist::isBlacklisted($customer->email)) {
    return;
}

// use $customer to send the data where you need it.

}, 1000);
 

d3m0n

Member
Gotcha. Unfortunately, we don't have any direct hook there yet, so your best bet would be to connect to the 'controller_action_save_data' action hook:
Code:
Yii::app()->hooks->addAction('controller_action_save_data', function(CAttributeCollection $collection) {

if ($collection->itemAt('controller')->getRoute() != 'guest/register') {
     return;
}
   
if (!$collection->itemAt('success')) {
    return;
}

/** @var Customer $model */
$customer = $collection->itemAt('model');

if (!$customer->validate()) {
    return;
}

if (EmailBlacklist::isBlacklisted($customer->email)) {
    return;
}

// use $customer to send the data where you need it.

}, 1000);
Thank you very much
 

d3m0n

Member
A quick question, if I create a plugin / an extension can I connect to controller_action_save_data' action hook via an extension?
 
Top