I have gotten so far that I can create a new campaign in my campaign list in mailchimp using a java class, however, I am not getting there to send it, see code, does anyone have suggestions?
it executes the creation of the campaign (and i see it in mailchimp), and I receive back the campaignInfo object, but from the point to send this campaign, I cant figure it out
package mailingapp2;
import com.ecwid.maleorang.MailchimpClient;
import com.ecwid.maleorang.method.v3_0.campaigns.CampaignActionMethod;
import com.ecwid.maleorang.method.v3_0.campaigns.CampaignInfo;
import com.ecwid.maleorang.method.v3_0.campaigns.CampaignInfo.SettingsInfo;
import static com.ecwid.maleorang.method.v3_0.campaigns.CampaignInfo.Type.PLAINTEXT;
import com.ecwid.maleorang.method.v3_0.campaigns.EditCampaignMethod;
public class SendMailchimpCampaign {
public void SendCampaign() throws Exception {
String apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String listId = "d069f8c902";
String Email ="test@test.be";
String firstName = "test";
String lastName = "test";
MailchimpClient client = new MailchimpClient(apiKey);
try{
EditCampaignMethod.Create method = new EditCampaignMethod.Create();
method.type = PLAINTEXT;
method.settings = new SettingsInfo();
method.settings.mapping.put("title", "test2");
method.settings.mapping.put("subject_line", "test");
method.settings.mapping.put("from_name", "test");
method.settings.mapping.put("reply_to", "info@test.be");
CampaignInfo campaign = client.execute(method); //until here it works, //it executes, and I receive back the campaignInfo object, but from here I can't //figure it out how to move on to send this campaign.
CampaignActionMethod.Send send = new CampaignActionMethod.Send(listId);
System.out.println("info" + campaign);
}catch (Exception e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
}