/** * get template lists of sendinblue */ public static function get_template_lists() { $mailin = new Mailin('https://api.sendinblue.com/v1.0', SIB_Manager::$access_key, SIB_Manager::$secret_key); $response = $mailin->get_campaigns('template'); return $response['data']['campaign_records']; }
<?php require '../mailin.php'; /* * This will initiate the API with the endpoint and your access and secret key. * */ $mailin = new Mailin('https://api.sendinblue.com/v1.0', 'Your access key', 'Your secret key'); /* * This will get all your campaigns * */ var_dump($mailin->get_campaigns());
/** * Get campaign stats */ static function get_campaign_stats() { $access_key = SIB_Manager::$access_key; $secret_key = SIB_Manager::$secret_key; $mailin = new Mailin('https://api.sendinblue.com/v1.0', $access_key, $secret_key); $response = $mailin->get_campaigns(""); $ret = array('classic' => array('Sent' => 0, 'Draft' => 0, 'Queued' => 0, 'Suspended' => 0, 'In_process' => 0, 'Archive' => 0, 'Temp_active' => 0, 'Temp_inactive' => 0), 'sms' => array('Sent' => 0, 'Draft' => 0, 'Queued' => 0, 'Suspended' => 0, 'In_process' => 0, 'Archive' => 0, 'Temp_active' => 0, 'Temp_inactive' => 0), 'trigger' => array('Sent' => 0, 'Draft' => 0, 'Queued' => 0, 'Suspended' => 0, 'In_process' => 0, 'Archive' => 0, 'Temp_active' => 0, 'Temp_inactive' => 0)); $campaign_records = $response['data']['campaign_records']; foreach ($campaign_records as $campaign_record) { if ($campaign_record['type'] == 'template') { continue; } $ret[$campaign_record['type']][$campaign_record['status']]++; } return $ret; }