How to create a campaign using mailchimp v3.0
Asked Answered
S

3

3

I am trying to create a new campaign using MailChimp API v3.0 but I do not see any method that allows me to make this in the resources of the API. Does anyone know how I can do this?

Santalaceous answered 15/7, 2015 at 10:30 Comment(0)
C
8

This was not possible when I originally answered this question, but the API has been updated to include campaign creation.

Caffrey answered 15/7, 2015 at 15:13 Comment(1)
I thought I was crazy because I couldn't find how to send the content for the campaign. Finally found that now you need a second request to set the campaign content. ThanksObsidian
B
3

PHP solution using POST request:

//Sample Data
$data = array("recipients" => array("list_id" => "205d96e6b4"), "type" => "regular", "settings" => array("subject_line" => "Subject", "title" => "Title", "reply_to" => "[email protected]", "from_name" => "Test", "folder_id" => "8888969b77"));
$data = json_encode($data);
$curl = curl_init();
curl_setopt_array($curl, array(    
   //Sample url
   CURLOPT_URL => "https://xxx.api.mailchimp.com/3.0/campaigns",
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_TIMEOUT => 30,
   CURLOPT_CUSTOMREQUEST => "POST",
   CURLOPT_POSTFIELDS => $data,
   CURLOPT_HTTPHEADER => array(
      "authorization: apikey <your_apikey>"
   ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
   $response = $err;
}
Bola answered 4/5, 2017 at 18:3 Comment(1)
Thank you soooo much! This way the only way I could get it. I appreciate you posting this!Abominable
M
0

Send a POST Request to this address

"https://us15.api.mailchimp.com/3.0/campaigns?apikey=****"

with following Content in Raw data attachment.

{
    "type":"regular",
"list_id":"****",
"subject_line":"Your Purchase Receipt",
"reply_to":"[email protected]",
"from_name":"Customer Service",
"settings":{"subject_line":"Your Purchase Receipt","reply_to":"[email protected]","from_name":"Customer Service"}

}

for more please refer to following documentation. http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#create-post_campaigns

Megadeath answered 22/2, 2017 at 6:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.