This repository has been archived by the owner on Nov 30, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from AKarismatik/master
add segment and send campaign to segment
- Loading branch information
Showing
3 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,9 @@ MZMailChimpBundle is licensed under the MIT License - see the `Resources/meta/LI | |
5. `campaignCreate` | ||
6. `campaignSendTest` | ||
7. `campaignSendNow` | ||
8. `listStaticSegmentAdd` | ||
9. `listStaticSegmentMembersAdd` | ||
10. `listStaticSegments` | ||
|
||
**MailChimp Export API Method Supported** | ||
|
||
|
@@ -256,3 +259,65 @@ mz_mail_chimp: | |
|
||
$ecommerce->getOrder($pageStart, $batchLimit, $dateSince) //return array | ||
``` | ||
|
||
**MailChimp API [create static segment](http://apidocs.mailchimp.com/api/2.0/lists/static-segment-add.php) in a controller** | ||
|
||
``` php | ||
<?php | ||
|
||
$mailChimp = $this->get('MailChimp'); | ||
$list = $mailChimp->getList(); | ||
$list->listStaticSegmentAdd('first_segment'); // return int segment id | ||
|
||
``` | ||
|
||
**MailChimp API [segment member add](http://apidocs.mailchimp.com/api/2.0/lists/static-segment-members-add.php) in a controller** | ||
|
||
``` php | ||
<?php | ||
|
||
$mailChimp = $this->get('MailChimp'); | ||
$list = $mailChimp->getList(); | ||
$segmentId = $list->listStaticSegmentAdd('first_segment'); | ||
$batch = array('[email protected]',[email protected]'); | ||
$list->listStaticSegmentMembersAdd($segmentId, $batch); | ||
|
||
``` | ||
|
||
**MailChimp API [list static segment](http://apidocs.mailchimp.com/api/2.0/lists/static-segments.php) in a controller** | ||
|
||
``` php | ||
<?php | ||
|
||
$mailChimp = $this->get('MailChimp'); | ||
$list = $mailChimp->getList(); | ||
$segments = $list->listStaticSegments(); | ||
|
||
``` | ||
|
||
**MailChimp API [send campaign to segment] in a controller** | ||
|
||
``` php | ||
<?php | ||
|
||
$mailChimp = $this->get('MailChimp'); | ||
$campaign = $mailChimp->getCampaign(); | ||
$list = $mailChimp->getList(); | ||
$segmentId = $list->listStaticSegmentAdd('first_segment'); | ||
$batch = array('[email protected]',[email protected]'); | ||
$list->listStaticSegmentMembersAdd($segmentId, $batch); | ||
$conditions[] = array( | ||
'field' => 'static_segment', | ||
'op' => 'eq', | ||
'value' => $segmentId | ||
); | ||
|
||
$segment_options = array( | ||
'match' => 'all', | ||
'conditions' => $conditions | ||
); | ||
$campaign->setSegmenOptions($segment_options); | ||
$campaignId = $campaign->create(); | ||
$campaign->SendNow($campaignId); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters