Is there a way to send the Mailchimp Welcome Email when using Mailchimp API 3 List/Member method? Older API implementations can do it without the need for Automation (paid feature), but I am not sure if API 3 supports it in List/Member method. I am referring to emails that users usually get when they sign up using a standard Mailchimp form.
For instance, this script will not send a Welcome email or any other post-sign up Mailchimp emails.
$apikey = '<api_key>';
$auth = base64_encode( 'user:'.$apikey );
$data = array(
'apikey' => $apikey,
'email_address' => $email,
'status' => 'subscribed',
'merge_fields' => array(
'FNAME' => $name
)
);
$json_data = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://us2.api.mailchimp.com/3.0/lists/<list_id>/members/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Basic '.$auth));
curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
$result = curl_exec($ch);
var_dump($result);
die('Mailchimp executed');
Click the Manage Audience drop-down and choose Signup forms. Select Form builder. Click the Forms and response emails drop-down menu, and choose Final welcome email. Check the box next to Send a final welcome email to turn the final welcome email on, or uncheck the box to turn it off.
It is very simple: Make sure to turn on the final welcome email in the list settings.
When executing the request set the status to pending. The user wil receive an welcome email in a few minutes.
$data = array(
'apikey' => $apikey,
'email_address' => $email,
'status' => 'pending'
);
If you turn on the final welcome email for your list it should send when you subscribe. There's currently no way to override the list setting in API v3.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With