Skip to content

Instantly share code, notes, and snippets.

@browny
Last active December 16, 2015 10:09
Show Gist options
  • Save browny/5418137 to your computer and use it in GitHub Desktop.
Save browny/5418137 to your computer and use it in GitHub Desktop.

###Workaround for welcome latter

  1. Subscribe the user to List

     ListSubscribeMethod req1 = new ListSubscribeMethod();
     req1.apikey = API_KEY;
     req1.id = LIST_ID;
     req1.email_address = "xxxx@gmail.com";
     // There is no need to send confirm letter
     req1.double_optin = false;
    
     Boolean res1 = client.execute(req1);
     log.info("Result: " + res1);
    
  2. Create campaign for specific user in the List

     CampaignCreateMethod req6 = new CampaignCreateMethod();
     req6.apikey = API_KEY;        
     req6.type = CampaignType.regular;
    
     // fill the email content
     TestOptions options = new TestOptions();
     options.list_id = "00d7e7e094";
     options.subject = "ByeBye";
     options.from_email = "byebye@gmail.com";
     options.from_name = "Girl";
     options.to_name = "Fan";
     req6.options = options;
    
     TestContent content = new TestContent();
     content.text = "Hello World";
     req6.content = content;
    
     // Filter the specific segment of the List
     Options op = new Options();
     op.match = "any";
    
     Conditions cond = new Conditions();
     cond.field = "email";
     cond.op = "eq";
     cond.value = "xxxx@gmail.com"; // yes, it is the mail registered before
    
     op.conditions = new ArrayList<Conditions>();
     op.conditions.add(cond);
     req6.segment_opts = op;
    
     String res6 = client.execute(req6);
     log.info("Result: " + res6);
    
  3. Send the campaign

     CampaignSendNowMethod req3 = new CampaignSendNowMethod();
     req3.apikey = API_KEY;
     req3.cid = res6; // The campaign created before
    
     Boolean res3 = client.execute(req3);
     log.info("Result: " + res3);
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment