Aimtell PHP SDK
Aimtell offers a service for push notifications to users who give permission. This package allows for interfacing with Aimtell's backend API to manage your account.
Aimtell REST API Documentation
Installation
You can install the package via composer:
composer require collinped/aimtell-php
Usage
Quick Example
$aimtell = new Collinped\Aimtell($apiKey, $defaultSiteId, $whiteLabelId);
$site = $aimtell->site()
->create([
'name' => 'Sample Website',
'url' => 'collinped.com'
]);
$campaigns = $aimtell->site($siteId)
->campaign()
->all();
$campaign = $aimtell->site($siteId)
->campaign()
->find($campaignId);
Authentication
- Get API Key
- Set API Key
- Get Default Site ID
- Set Default Site ID
- Get White Label ID
- Set White Label ID
Sites
- Get All Websites
- Get Website
- Get Website Code
- Add Website
- Update Website Details
- Get Website Settings
- Update Website Settings
- Update Website Package (Safari)
- Delete Website
- Get Website Keys
- Upsert Website Keys
Subscribers
- Get All Subscribers
- Get Subscriber
- Track Subscriber Attributes
- Track Subscriber Event
- Opt-Out Subscriber
Segments
- Get All Segments
- Get Segment
- Create Segment
- Update Segment
- Delete Segment
- Get Segment Counts Over Time (By Day)
Welcome Notification Campaign
- Get Welcome Notification
- Get Welcome Notification Campaign Results (By Day)
- Update Welcome Notification (Upsert)
Manual Campaigns
- Get All Manual Campaigns
- Get Manual Campaign
- Get Manual Campaign Clicks
- Get Manual Campaign Results (By Day)
- Create Manual Campaign
- Update Manual Campaign
- Delete Manual Campaign
Triggered Campaigns
- Get All Event Triggered Campaigns
- Get Event Triggered Campaign
- Get Event Triggered Campaign Results (By Day)
- Create Event Triggered Campaign
- Update Event Triggered Campaign
- Delete Event Triggered Campaign
RSS Campaigns
- Get All RSS Campaigns
- Get RSS Campaign
- Create RSS Campaign
- Update RSS Campaign
- Delete RSS Campaign
API Campaigns
- Get All API Campaigns
- Get API Campaign
- Get Event API Campaign Results (By Day)
Send Push Notifications
- Send a Push Notification
Authentication
Get API Key
$aimtell = $aimtell->getApiKey();
Set API Key
$aimtell = $aimtell->setApiKey($apiKey);
Get Default Site ID
$aimtell = $aimtell->getDefaultSiteId();
Set Default Site ID
$aimtell = $aimtell->setDefaultSiteId($defaultSiteId);
Get White Label ID
$aimtell = $aimtell->getWhiteLabelId();
Set White Label ID
$aimtell = $aimtell->setWhiteLabelId($whiteLabelId);
Sites
Aimtell Docs
Get All Websites -$websites = $aimtell->site()
->all();
Aimtell Docs
Get Website -$website = $aimtell->site()
->find($siteId);
Aimtell Docs
Get Website Code -$website = $aimtell->site($siteId)
->getCode();
Aimtell Docs
Add Website -$websites = $aimtell->site()
->create([
'name' => 'Website Name', // Required
'url' => 'facebook.com' // Required
]);
Aimtell Docs
Update Website Details -$websites = $aimtell->site($siteId)
->update([
'name' => 'Website Name',
'url' => 'facebook.com'
'icon' => 'imageUrl.jpg'
]);
Aimtell Docs
Get Website Settings -$websites = $aimtell->site($siteId)
->getSettings();
Aimtell Docs
Update Website Settings -$websites = $aimtell->site($siteId)
->updateSettings([
...
]);
Aimtell Docs
Update Website Package (Safari) -$websites = $aimtell->site($siteId)
->updatePackage();
Aimtell Docs
Delete Website -$websites = $aimtell->site($siteId)
->delete();
Aimtell Docs
Get Website Keys -$websites = $aimtell->site($siteId)
->getKeys();
Aimtell Docs
Upsert Website Keys -$websites = $aimtell->site($siteId)
->upsertKeys([
...
]);
Subscribers
Aimtell Docs
Get All Subscribers -$subscribers = $aimtell->site($siteId)
->subscriber()
->all();
Aimtell Docs
Get Subscriber -$subscriber = $aimtell->site($siteId)
->subscriber()
->find($subscriberId);
Aimtell Docs
Track Subscriber Attribute -$subscriber = $aimtell->site($siteId)
->subscriber($subscriberId)
->trackEvent([
'first_name' => 'jeff'
'gender' => 'male'
]);
Aimtell Docs
Track Subscriber Event -$subscriber = $aimtell->site($siteId)
->subscriber($subscriberId)
->trackEvent([
'category' => '' // Required
'action' => '', // Required
'label' => '',
'value' => 1.00
]);
Aimtell Docs
Opt-Out Subscriber -$subscriber = $aimtell->site($siteId)
->subscriber($subscriberId)
->optOut();
Segments
Aimtell Docs
Get All Segments -$segments = $aimtell->site($siteId)
->segment()
->all();
Aimtell Docs
Get Segment -$segment = $aimtell->site($siteId)
->segment()
->find($segmentId);
Aimtell Docs
Create Segment -$segment = $aimtell->site($siteId)
->segment()
->create([
'name' => 'Segment Name'
'definition' => 'city==Irvine' // See Aimtell Docs
]);
Aimtell Docs
Update Segment -$segment = $aimtell->site($siteId)
->segment($segmentId)
->update([
'name' => 'Segment Name'
'definition' => 'city==Irvine' // See Aimtell Docs
]);
Aimtell Docs
Delete Segment -$segment = $aimtell->site($siteId)
->segment($segmentId)
->delete();
Aimtell Docs
Get Segment Counts Over Time (By Day) -$results = $aimtell->site($siteId)
->segment($segmentId)
->getResultsByDate([
'startDate' => '1/1/2020',
'endDate' => '1/30/2020'
]);
Welcome Notifications
Aimtell Docs
Get Welcome Notification -$welcomeNotification = $aimtell->site($siteId)
->welcomeNotification()
->get();
Aimtell Docs
Get Welcome Notification Results (By Day) -$results = $aimtell->site($siteId)
->welcomeNotification()
->getResultsByDate([
'startDate' => '1/1/2020',
'endDate' => '1/30/2020'
]);
Aimtell Docs
Update Welcome Notification (Upsert) -$welcomeNotification = $aimtell->site($siteId)
->welcomeNotification()
->update([
'title' => 'Welcome Title', // Required
'body' => 'Welcome body', // Required
'link' => 'http://facebook.com', // Required
'status' => '1' // Required - 0 = Draft, 1 = Active
]);
Manual Campaigns
Aimtell Docs
Get All Manual Campaigns -$campaigns = $aimtell->site($siteId)
->campaign()
->all();
Aimtell Docs
Get Manual Campaign -$campaign = $aimtell->site($siteId)
->campaign()
->find($campaignId);
Aimtell Docs
Get Manual Campaign Clicks -$campaign = $aimtell->site($siteId)
->campaign($campaignId)
->getClicks();
Aimtell Docs
Get Manual Campaign Results (By Day) -$campaign = $aimtell->site($siteId)
->campaign($campaignId)
->getResultsByDate([
'startDate' => '01/01/2020',
'endDate' => '02/15/2020',
]);
Aimtell Docs
Create Manual Campaign -$campaign = $aimtell->site($siteId)
->campaign($campaignId)
->create([
'name' => 'Campaign Name', // Required
'title' => 'Campaign Title',
...
]);
Aimtell Docs
Update Manual Campaign -$campaign = $aimtell->site($siteId)
->campaign($campaignId)
->update([
'name' => 'New Campaign Name',
'title' => 'New Campaign Title',
...
]);
Aimtell Docs
Delete Manual Campaign -$campaign = $aimtell->site($siteId)
->campaign($campaignId)
->delete();
Send Push Notifications
Aimtell Docs
Send a Push Notification -$notification = $aimtell->site($siteId)
->push()
->title('Sample Notification')
->message('Here is your sample message')
->link('https://www.laravel.com')
->toSubscriber($subscriberId)
->withButton([
'link' => 'sampleUrl',
'title' => 'Sample Title 1',
])
->withButton([
'link' => 'sampleUrl2',
'title' => 'Sample Title 2',
])
->send();
Testing
composer test
Todo
- A/B Tests for Manual Campaigns
- Create Manual Campaign (Batch)
- Update Manual Campaign (Batch)
- Delete Manual Campaign (Batch)
- Create Event Triggered Campaign (Batch)
- Update Event Triggered Campaign (Batch)
- Delete Event Triggered Campaign (Batch)
- Get Notification Logs
- Get Attributes Logs
- Get Pageview Logs
- Get Event Logs
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.