API - getting subscribers in segment

eggerda

Member
Hello, brand new customer of MailWizz, and it's amazing what these guys have done. Excited to integrate into my business sending platform.

Question: it's very important that we are able to use the API to GET specific subscribers from MailWizz that have been sent a certain autoresponder.

My idea is to set a custom field once the autoresponder has been sent. And then create as segment for all of these subscribers that have this specific custom field set to a value?

How can we use the API to GET just these subscribers? Let me know if this is possible. We will need to GET them and then unsubscribe them from MailWizz.

Thanks, Dan
 

eggerda

Member
Oh yes! That wold be amazing @twisted1919! Basically, we will create a custom field value when a certain autoresponder is SENT to a contact. Then our script will run and get ALL contacts in a certain list with THIS specific custom field value.

Will that be easy functionality to add? That would be amazing! Let me know...

P.S. I don't think getting the "segments" will work because I'd want it to return a list of all contacts in the segment, not the list of segments itself. If you could do the above for me, that would be amazing!
 

twisted1919

Administrator
Staff member
@eggerda - i have added this in our dev and it will be available in the next release, here's how you will be able to use it:
PHP:
<?php

// require the autoloader class
require_once dirname(__FILE__) . '/../twisted1919-mailwizz-php-sdk/MailWizzApi/Autoloader.php';

// register the autoloader.
MailWizzApi_Autoloader::register();

// configuration object
$config = new MailWizzApi_Config(array(
    'apiUrl'        => 'http://mailwizz.test/api/index.php',
    'publicKey'     => 'xxx',
    'privateKey'    => 'yyy',
));

// now inject the configuration and we are ready to make api calls
MailWizzApi_Base::setConfig($config);

// start UTC
date_default_timezone_set('UTC');

// CREATE THE ENDPOINT
$endpoint = new MailWizzApi_Endpoint_ListSubscribers();

// SEARCH BY custom field
$response = $endpoint->searchByCustomFields('sh296mj4sddc4', array(
    'FNAME' => 'the fname',
    'LNAME'  => ' the lname',
));

// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
 

eggerda

Member
@twisted1919 thank you so much! Amazing support.

2 quick questions:

1. I assume this code will search ALL contacts on all lists? If so, if we've got, say 20,000 contacts, will it return results to our script fast?

2. Will the results we get include all custom field values for each contact?

Thank you!

Dan
 

eggerda

Member
@twisted1919 , just checking to make sure I didn't miss the release? I never got a notification on my dash...making sure I have that setting on as well. Let me know... thanks!
 

eggerda

Member
@twisted1919, no worries, thank you! We've still got more to do to be ready for go live with MailWizz.

One more thing with this extension: List form custom redirect

What would it take to enable that redirect for the "update profile" page? If someone accidentally subscribes again (or on purpose) instead of showing them this page, we just want to redirect them... let me know who I need to talk to... thank you!

Dan
 

laurentiu

Active Member
Staff member Support Staff
@eggerda - Unfortunately, as far as i know, there is no way to do redirect in that page. instead, edit your email list and there is a field Sub. exists redirect to redirect people to some location when they try to register in a list and they already exist.
 

eggerda

Member
@twisted1919 hello! Just a quick check to see when the next release is coming so we can test the new API call you've created for us above? Let us know... thank you! - Dan
 

gteindia

Member
@twisted1919 I need some help.

I want to know whether it is possible for me to use the API to add subscriber to the selected MW list without going through the import routine. I want to use my standalone VBA code / Python script to directly add email addresses to the MW system.
 
Top