How to create OUTGOING webhooks (triggered by Mailwizz events)?

SteveSJ

New Member
Hello everybody,

Mailwizz does a great job in integrating with all the different SMTP services, including automatically configuring their webhooks.

So I'd like to take advantage of that by having Mailwizz fire a configurable (outgoing) webhook (with all subscriber data available as tokens) to my CRM system on certain Mailwizz events - especially the UNSUBSCRIBE event.

The goal of this setup is to keep my CRM up-to-date whenever a subscriber unsubscribes, no matter if that unsubscribe happened because of e.g. a HARD BOUNCE at Mailjet, a SPAM complaint at Sparkpost, or simply because the user clicked the Mailwizz unsubscribe link.

I'm pretty new to Mailwizz so I was wondering if someone could maybe give me a few pointers on what might be the best approach to achieve this. That would be highly appreciated.

Cheers,
Steve
 
Hello everybody,

Mailwizz does a great job in integrating with all the different SMTP services, including automatically configuring their webhooks.

So I'd like to take advantage of that by having Mailwizz fire a configurable (outgoing) webhook (with all subscriber data available as tokens) to my CRM system on certain Mailwizz events - especially the UNSUBSCRIBE event.

The goal of this setup is to keep my CRM up-to-date whenever a subscriber unsubscribes, no matter if that unsubscribe happened because of e.g. a HARD BOUNCE at Mailjet, a SPAM complaint at Sparkpost, or simply because the user clicked the Mailwizz unsubscribe link.

I'm pretty new to Mailwizz so I was wondering if someone could maybe give me a few pointers on what might be the best approach to achieve this. That would be highly appreciated.

Cheers,
Steve
try the api
https://github.com/twisted1919/mailwizz-php-sdk/blob/master/MailWizzApi/
it even has some examples
;)
 
Thanks a lot frm.mwz for your quick answer.
Actually I know the API SDK but I couldn't find anything in there that looked like it was triggered by a Mailwizz event.
I've looked at these endpoints: https://screencast.com/t/Kj3lmu9sa3
Maybe I need to look somewhere else?
hmm, if i had to do this right now i would look into:
# integration tools posts here at the forum
# learning from webhooks inside mwz as they fire to the outside
# triggers and routines in phpMyAdmin
...hope this helps a bit ;)
 
@SteveSJ - You'll like this :) Mailwizz already has this functionality, implemented via an extension you have to enable.
Once you enable the extension called "List form custom webhooks" you will be able to edit your list forms and add a url where mailwizz will post various data when a subscriber subscribes / unsubscribes / etc.
If the extension doesn't do all you wnat it to do, then you can duplicate it and extend it for your own use case ;)
 
@twisted1919 - sounds great. Any idea if it's also being triggered when the unsubscribe happens due to e.g. a BOUNCE reported by any of the configured Web API delivery servers?
 
Any idea if it's also being triggered when the unsubscribe happens due to e.g. a BOUNCE reported by any of the configured Web API delivery servers?
We don't unsubscribe when a bounce happens. These two are different things. Unsubscribe is only happening when the subscriber unsubscribes or when a abuse complaint is filled by the subscriber.
 
@twisted1919 - ok so let me rephrase my question then: is it also being triggered when the unsubscribe happens due to an ABUSE COMPLAINT reported by any of the configured Web API delivery servers?
 
@SteveSJ - I thought it did, but looking at the code it seems it is strictly connected to the list forms in the web interface, so unfortunately you'd have to code this functionality...
 
ok I see, no worries. What would be the best place for starting the coding of this? I mean, where's that EVENT (abuse being reported by an incoming webhook) available?
 
@SteveSJ - This is going to be tricky, but here's how you can do this from an extension:
PHP:
// hook into mailwizz DSWH controller:  /apps/frontend/controllers/DswhController.php
Yii::app()->hooks->doAction('frontend_controller_dswh_after_action', function($action){

    // look into actionIndex in the DSWH controller.
    if ( $action->id != 'index' ) {
        return;
    }

    // load the delivery server based on it's id.
    $server = DeliveryServer::model()->findByPk((int)Yii::app()->request->getQuery('id'));

    // for each server type, handle differently since they send different data.
   // see the controller for how mailwizz handles them.
    if ( $server->type == 'sendgrid-web-api' ) {
         $events = file_get_contents("php://input");
         // handle $events
    }
});
 
@twisted1919 Great stuff, thanks a lot! Now, is there possibly something like a short tutorial 'How to create your first extension' or maybe an extension template available somewhere?
 
Back
Top