API - getting subscribers in segment

Discussion in 'General discussions' started by eggerda, Feb 9, 2019.

  1. eggerda

    eggerda New Member

    Joined:
    Feb 9, 2019
    Messages:
    5
    Likes Received:
    0
    S.E:
    2020-02-09 05:21:21
    L.T:
    Regular
    L.C:
    1
    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
     
  2. ghimes

    ghimes New Member Staff Member

    Joined:
    Feb 2, 2018
    Messages:
    1
    Likes Received:
    0
  3. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    9,852
    Likes Received:
    2,311
    @eggerda - additionally to what @ghimes ( incepi sa te pricepi ) says, if you need to search by a specific custom field, we can add that functionality, just let us know.
     
  4. eggerda

    eggerda New Member

    Joined:
    Feb 9, 2019
    Messages:
    5
    Likes Received:
    0
    S.E:
    2020-02-09 05:21:21
    L.T:
    Regular
    L.C:
    1
    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!
     
  5. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    9,852
    Likes Received:
    2,311
    @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>';
     
    frm.mwz likes this.
  6. eggerda

    eggerda New Member

    Joined:
    Feb 9, 2019
    Messages:
    5
    Likes Received:
    0
    S.E:
    2020-02-09 05:21:21
    L.T:
    Regular
    L.C:
    1
    @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
     
  7. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    9,852
    Likes Received:
    2,311
    @eggerda -
    1. The result is paginated of course, otherwise, returning 20k records will kill your server.
    2. Yes.
     
  8. eggerda

    eggerda New Member

    Joined:
    Feb 9, 2019
    Messages:
    5
    Likes Received:
    0
    S.E:
    2020-02-09 05:21:21
    L.T:
    Regular
    L.C:
    1
    @twisted1919 Great! I think this will work... when will the next release come out so we can start using this? Thank you!
     
  9. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    9,852
    Likes Received:
    2,311
    @eggerda - we might have a maintenance release next week :)
     
  10. eggerda

    eggerda New Member

    Joined:
    Feb 9, 2019
    Messages:
    5
    Likes Received:
    0
    S.E:
    2020-02-09 05:21:21
    L.T:
    Regular
    L.C:
    1
    @twisted1919 , that's great! How will I know when it's ready? Will my MailWizz tell me somewhere?
     
  11. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    9,852
    Likes Received:
    2,311
    Yup, you'll get a notification in your mailwizz dashboard ;)
     

Share This Page