mkural2016
New Member
Which parameter should be added in the create function for the mailwizz api to work.
Code:
// CREATE CAMPAIGN
$response = $endpoint->create([
'name' => 'My API Campaign', // required
'type' => 'regular', // optional: regular or autoresponder
'from_name' => 'John Doe', // required
'from_email' => 'john.doe@doe.com', // required
'subject' => 'Hey, i am testing the campaigns via API', // required
'reply_to' => 'john.doe@doe.com', // required
'send_at' => date('Y-m-d H:i:s', strtotime('+10 hours')), // required, this will use the timezone which customer selected
'list_uid' => 'LIST-UNIQUE-ID', // required
'segment_uid' => 'SEGMENT-UNIQUE-ID',// 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
// - if autoresponder uncomment bellow:
//'autoresponder_event' => 'AFTER-SUBSCRIBE', // AFTER-SUBSCRIBE or AFTER-CAMPAIGN-OPEN
//'autoresponder_time_unit' => 'hour', // minute, hour, day, week, month, year
//'autoresponder_time_value' => 1, // 1 hour after event
//'autoresponder_open_campaign_id' => 1, // INT id of campaign, only if event is AFTER-CAMPAIGN-OPEN,
// - if this campaign is advanced recurring, you can set a cron job style frequency.
// - please note that this applies only for regular campaigns.
//'cronjob' => '0 0 * * *', // once a day
//'cronjob_enabled' => 1, // 1 or 0
],
// required block, 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>';