Modify an existing campaign by providing updated fields. Only the fields included in the request will be changed.
PUT API-URL/campaigns/CAMPAIGN-UNIQUE-ID
X-API-KEY: your-api-key-here
// UPDATE CAMPAIGN
$response = $endpoint->update('CAMPAIGN-XYZ123456', [
'name' => 'April Promo Campaign - Updated', // optional at update
'from_name' => 'Ethan Clark', // optional at update
'from_email' => 'ethan.clark@demo.org', // optional at update
'subject' => 'Updated Campaign: Explore Whatβs New!', // optional at update
'reply_to' => 'ethan.clark@demo.org', // optional at update
'send_at' => date('Y-m-d H:i:s', strtotime('+1 hour')), //optional at update, this will use the timezone which customer selected
'list_uid' => 'LIST-UID-456XYZ', // optional at update
'segment_uid' => 'SEGMENT-UID-123ABC', // optional, only to narrow down
// optional block, defaults are shown
'options' => [
'url_tracking' => 'no', // yes | no
'json_feed' => 'no', // yes | no
'xml_feed' => 'no', // yes | no
'plain_text_email' => 'yes', // yes | no
'email_stats' => null, // a valid email address where we should send the stats after campaign done
],
// optional block at update, archive or template_uid or content => required.
'template' => [
//'archive' => file_get_contents(__DIR__ . '/template-example.zip'),
//'template_uid' => 'TEMPLATE-UNIQUE-ID',
'content' => file_get_contents(__DIR__ . '/template-example.html'),
'inline_css' => 'no', // yes | no
'plain_text' => null, // leave empty to auto generate
'auto_plain_text' => 'yes', // yes | no
],
]);
// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';