PHP class for using our company's API as part of the subscription.
Run following command in terminal from the root of your project:
composer require emailplatform/api_parser
You can load dependencies by adding these lines to your code:
require_once 'vendor/emailplatform/api_parser/src/settings.php';
require_once 'vendor/emailplatform/api_parser/src/ApiParser.class.php';
- Set up your API credentials (apiusername & apitoken) into settings.php
- Create instance from ApiParser.class.php
$parser = new ApiParser($settings);
- Call method from ApiParser
$subscriberid = 68317547;
$listid = 0;
$emailaddress = "";
$mobileNumenr = "";
$mobilePrefix = "";
$fieldid = 14;
$fieldValue = array(
'Lastname' => "Tom",
'Firstname' => 'Jones',
'Date' => '31-12-2020 T00:00',
'Active' => 0
);
$path = 'Users[Lastname=SimpleChange4]';
$result = $parser->UpdateOTMDocument($subscriberid, $listid, $emailaddress, $mobileNumber, $mobilePrefix, $fieldid, $fieldValue, $path);
print_r($result);
- ChangeMobile
Now:
$Mobile no longer require parameters
- ScheduleSendSMS
*Previous:
public function ScheduleSendSMS($campaignid = false, $lists = false, $hours = false)
Now:
public function ScheduleSendSMS($campaignid = false, $hours = false)
- UpdateOTMDocument
Previous:
public function UpdateOTMDocument ($subscriberid = 0, $fieldid = 0, $fieldValueOTM = array(), $path = "")
Now:
public function UpdateOTMDocument ($subscriberid = 0, $listid = 0, $emailaddress = "", $mobileNumber = "", $mobilePrefix = "", $fieldid = 0, $fieldValueOTM = array(), $path = "")
- Added: listid, emailaddress, mobileNumber and mobilePrefix.
- GetSubscriberDetails
Previous:
listid was required.
Now:
listid is not required if subscriberid is specified.
- ScheduleSendNewsletter
Previous:
public function ScheduleSendNewsletter($campaignid = false, $hours = false, $saveSnapshots = true, $reloadFeed = true)
Now:
public function ScheduleSendNewsletter($campaignid = false, $hours = false, $saveSnapshots = true, $reloadFeed = true, $notifyOwner = false)
- Added: notifyOwner
- ScheduleSendNewsletterToLists
Previous:
public function ScheduleSendNewsletterToLists($newsletterid = false, $timeToSend = false, $listids = array(), $saveSnapshots = true, $reloadFeed = true)Now:
public function ScheduleSendNewsletterToLists($newsletterid = false, $timeToSend = false, $listids = array(), $saveSnapshots = true, $reloadFeed = true, $notifyOwner = false)
- Added: notifyOwner
- ScheduleSendNewsletterToSegments
Previous:
public function ScheduleSendNewsletterToSegments($newsletterid = false, $timeToSend = false, $segmentids = array(), $saveSnapshots = true, $reloadFeed = true)Now:
public function ScheduleSendNewsletterToSegments($newsletterid = false, $timeToSend = false, $segmentids = array(), $saveSnapshots = true, $reloadFeed = true, $notifyOwner = false)
- Added: notifyOwner
- SendNewsletter
Previous:
public function SendNewsletter($newsletterid = 0, $subscriberid = 0, $email = '', $senderEmail = '', $senderName = '', $replyEmail = '', $callbackUrl = false, $reloadFeed = false)Now:
public function SendNewsletter($newsletterid = 0, $subscriberid = 0, $email = '', $senderEmail = '', $senderName = '', $replyEmail = '', $callbackUrl = false, $reloadFeed = false, $notifyOwner = false)
- Added: notifyOwner
- UpdateOTMDocument
public function UpdateOTMDocument ($subscriberid = 0, $fieldid = 0, $fieldValueOTM = array(), $path = "")
- RemoveOTMDocument
public function RemoveOTMDocument ($subscriberid = 0, $fieldid = 0, $path = "", $index = 0)
- ScheduleSendNewsletter
Previous:
public function ScheduleSendNewsletter($campaignid = false, $hours = false, $saveSnapshots = true)Now:
public function ScheduleSendNewsletter($campaignid = false, $hours = false, $saveSnapshots = true, $reloadFeed = true)
- Added: reloadFeed
- ScheduleSendNewsletterToLists
Previous:
public function ScheduleSendNewsletterToLists($newsletterid = false, $timeToSend = false, $listids = array())Now:
public function ScheduleSendNewsletterToLists($newsletterid = false, $timeToSend = false, $listids = array(), $saveSnapshots = true, $reloadFeed = true)
- Added: saveSnapshots and reloadFeed
- ScheduleSendNewsletterToSegments
Previous:
public function ScheduleSendNewsletterToSegments($newsletterid = false, $timeToSend = false, $segmentids = array())Now:
public function ScheduleSendNewsletterToSegments($newsletterid = false, $timeToSend = false, $segmentids = array(), $saveSnapshots = true, $reloadFeed = true)
- Added: saveSnapshots and reloadFeed
- CreateSegment
public function CreateSegment($name = "", $rules = array(), $connector = 'and')
- AddCustomFieldsToList
public function AddCustomFieldsToList($listid = false, $customFields = array())
- SendNewsletter
Previous:
public function SendNewsletter($newsletterid = 0, $subscriberid = 0, $email = '', $senderEmail = '', $senderName = '', $replyEmail = '')Now:
public function SendNewsletter($newsletterid = 0, $subscriberid = 0, $email = '', $senderEmail = '', $senderName = '', $replyEmail = '', $callbackUrl = false, $reloadFeed = false)
- Added: callbackUrl and reloadFeed
- ScheduleSendNewsletterToLists
Definition:
public function ScheduleSendNewsletterToLists($newsletterid = false, $timeToSend = false, $listids = array())
- ScheduleSendNewsletterToSegments
Definition:
public function ScheduleSendNewsletterToSegments($newsletterid = false, $timeToSend = false, $segmentids = array()))
- ScheduleSendNewsletter
Previous:
public function ScheduleSendNewsletter($campaignid = false, $hours = false)Now:
public function ScheduleSendNewsletter($campaignid = false, $hours = false, $saveSnapshots = true)
- Added: $saveSnapshots
- GetSentEmailCampaignEvents
Definition:
public function GetSentEmailCampaignEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetSentEmailCampaignWithTriggerEvents
Definition:
public function GetSentEmailCampaignWithTriggerEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetOpenCampaignEvents
Definition:
public function GetOpenCampaignEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetOpenTriggersEvents
Definition:
public function GetOpenTriggersEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetLinkClickCampaignEvents
Definition:
public function GetLinkClickCampaignEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetLinkClickTriggerEvents
Definition:
public function GetLinkClickTriggerEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetSentAutoresponderEvents
Definition:
public function GetSentAutoresponderEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetOpenAutoresponderEvents
Definition:
public function GetOpenAutoresponderEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetLinkClickAutoresponderEvents
Definition:
public function GetLinkClickAutoresponderEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetSentSMSCampaignEvents
Definition:
public function GetSentSMSCampaignEvents($from = false, $to = false $limit = 10, $offset = 0)
- GetTrackingEvents
Definition:
public function GetTrackingEvents($listid = false, $subscriberid = false, $limit = 100, $offset = 0)
- GetLeadScore
Definition:
public function GetLeadScore($subscriberid = false)
- SetLeadScore
Definition:
public function SetLeadScore($subscriberid = false, $leadScore = false, $type = "add")
- GetCustomFields
Previous:
public function GetCustomFields($listids = false)Now:
public function GetCustomFields($listids = false)
- listids: is not required.
- GetSnapshots
Definition:
public function GetSnapshots($subscriberid = false, $triggerid = false, $autoresponderid = false, $campaignid = false, $groupby = "date")
- GetNewsletterSummary
Definition:
public function GetNewsletterSummary($newsletterid = false, $statid = false, $from = false, $to = false)
- GetStatids
Definition:
public function GetStatids($listid = false, $segmentid = false, $newsletterid = false, $from = false, $to = false, $limit = 100, $offset = 0)
- ResubscribeContact
Previous:
public function ResubscribeContact($listid = false, $emailaddress = false, $mobileNumber = false, $mobilePrefix = false, $add_to_autoresponders = false)Now:
public function ResubscribeContact($listid = false, $emailaddress = false, $mobileNumber = false, $mobilePrefix = false, $add_to_autoresponders = false, $contactFields = array())
- Added: $contactFields.
- GetTriggers
Definition:
public function GetTriggers($listid = false, $limit = 1000, $offset = 0)
- GetSegments
Definition:
public function GetSegments($listid = false, $count_subscribers = false, $limit = 100, $offset = 0)
- AddToOTMDocument
Definition:
public function AddToOTMDocument ($listid = false, $subscriberid = false, $emailaddress = false, $mobile = false, $mobilePrefix = false, $fieldid = false, $values = array(), $path = false)
- GetSubscribersByCustomField
Definition:
public function GetSubscribersByCustomField ($listid = false, $data = array(), $activeonly = true, $countonly = false, $limit = 1000, $offset = 0)
- GetTriggerSummary
Definition:
public function GetTriggerSummary($triggerid = false, $from = false, $to = false)
- GetAutoresponderSummary
Definition:
public function GetAutoresponderSummary($autoresponderid = false, $from = false, $to = false)
- GetSegmentSummary
Definition:
public function GetSegmentSummary($segmentid = false, $from = false, $to = false)
- GetRulesForSegment
Definition:
public function GetRulesForSegment($segmentid = false)
- EditNewsletter
Definition:
public function EditNewsletter($newsletterid = false, $name = false, $subject = false)
- SetTriggerStatus
Definition:
public function SetTriggerStatus($triggerid = false, $status = false)
- SetAutoresponderStatus
Definition:
public function SetAutoresponderStatus($autoresponderid = false, $status = false)
- SendSMS
Definition:
public function SendSMS($campaignid = 0, $subject = '', $text = '', $subscriberid = 0, $listid = 0, $mobile = '', $mobilePrefix = '')
- GetSubscribersFromSegment
Definition:
public function GetSubscribersFromSegment($segmentid = false, $countonly = false, $activeonly = true, $limit = 100, $offset = 0)
- GetTriggersForSegment
Definition:
public function GetTriggersForSegment($segmentid)
- ViewNewsletter
Definition:
public function ViewNewsletter($newsletterid)
- GetNewsletters
Previous:
public function GetNewsletters($countOnly= false, $getLastSentDetails = false, $content = true, $aftercreatedate = false, $newsletterNameLike = false)Now:
public function GetNewsletters($countOnly= false, $getLastSentDetails = false, $content = true, $aftercreatedate = false, $newsletterNameLike = false, $limit = false, $offset = false)
- Added: $limit & $offset.
Old name [v1.0] | New name [v1.1] |
---|---|
Create_List | CreateList |
Update_List | UpdateList |
Delete_List | DeleteList |
Update_Subscriber | UpdateSubscriber |
Copy_Newsletter | CopyNewsletter |
- UnsubscribeSubscriberEmail
Previous:
public function UnsubscribeSubscriberEmail ($emailaddress = false, $listid = false, $subscriberid = false, $skipcheck = false, $statid = false)Now:
public function UnsubscribeSubscriberEmail ($listid = false, $emailaddress = false, $subscriberid = false, $skipcheck = false, $statid = false)
- UnsubscribeSubscriberMobile
Previous:
public function UnsubscribeSubscriberMobile ($mobile = false, $mobilePrefix = false, $listid = false, $subscriberid = false, $skipcheck = false, $statid = false)Now:
public function UnsubscribeSubscriberMobile ($listid = false, $mobile = false, $mobilePrefix = false, $subscriberid = false, $skipcheck = false, $statid = false)
- GetSubscriberDetails
Previous:
public function GetSubscriberDetails($emailaddress = false, $listid = false)Now:
public function GetSubscriberDetails($listid = false, $subscriberid = false, $emailaddress = false, $mobile = false, $mobile_prefix = false)
- Added: subscriberid, mobile and mobile_prefix.
- GetRecipients
Previous:
public function GetRecipients($statid = false, $stats_type = false, $count_only = false)Now:
public function GetRecipients($statid = false, $count_only = false)
- Removed: stats_type.
- ActivateSubscriber
Previous:
public function ActivateSubscriber ($service = false, $lists = false, $emailaddress = false, $mobile = false, $mobile_prefix = false)Now:
public function ActivateSubscriber ($service = false, $listid = false, $emailaddress = false, $mobile = false, $mobile_prefix = false, $subscriberid = false)
- Added: subscriberid.
- UpdateSubscriber
Previous:
public function UpdateSubscriber($subscriberid = false, $emailaddress = false, $mobile = false, $listid = false, $customfields = array())Now:
public function UpdateSubscriber($listid = false, $subscriberid = false, $emailaddress = false, $mobile = false, $mobilePrefix = false, $customfields = array())
- Added: mobile, mobilePrefix.
- ScheduleSendSMS
Previous:
public function ScheduleSendSMS($campaignid = false, $hours = false, $lists = false)Now:
public function ScheduleSendSMS($campaignid = false, $lists = false, $hours = false)