1. Go to this page and download the library: Download engagespot/php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
engagespot / php-sdk example snippets
use Engagespot\EngagespotClient;
$apiKey = 'your-api-key';
$apiSecret = 'your-api-secret';
$signingKey = 'your-signing-key';
$dataRegion = 'us'; // Optional
// Create an instance of EngagespotClient
$engagespot = new EngagespotClient($apiKey, $apiSecret);
use Engagespot\EngagespotClient;
$config = [
'apiKey' => 'your-api-key',
'apiSecret' => 'your-api-secret',
'signingKey' => 'your-signing-key',
'baseUrl' => 'https://api.engagespot.co/v3'
];
// Create an instance of EngagespotClient
$engagespot = new EngagespotClient($config);
$notificationData = [
'notification' => [
'title' => 'Sample Title',
'message' => 'Sample Message',
'icon' => 'sample-icon',
'url' => 'https://example.com',
'templateId' => 1,
],
'override' => [
'channels' => ['inApp', 'webPush'],
// other properties you want ot override
],
'recipients' => ['[email protected]'],
'category' => 'overrideCategory',
'data' => [
// custom data as you needed
],
],
];
$response = $engagespot->send($notificationData);
// Handle the response as needed
var_dump($response);
$notificationData = [
'notification' => [
'title' => 'Sample Title',
'message' => 'Sample Message',
'icon' => 'sample-icon',
'url' => 'https://example.com',
'templateIdentifier' => 'sampleTemplate',
'category' => 'sampleCategory',
'data' => [
// custom data as you need
],
],
'sendTo' => [
'topics' => ['topic1', 'topic2'],
'recipients' => ['[email protected]', '[email protected]'],
],
'override' => [
'channels' => ['inApp', 'webPush'],
// other properties you want to override
],
];
$response = $engagespot->send($notificationData);
use Engagespot\EngagespotClient;
$identifier = '[email protected]'; // your unique identifier
$profile = [
'email' => '[email protected]',
'any_key' => 'any_value'
];
$engagespot = new EngagespotClient($apiKey, $apiSecret);
$enagagespot->createOrUpdateUser($identifier, $profile);
$enagagespot->setSigningKey($signingKey);
use Engagespot\EngagespotClient;
$apiKey = 'your-api-key';
$apiSecret = 'your-api-secret';
$signingKey = 'your-signing-key';
// Create an instance of EngagespotClient
$engagespot = new EngagespotClient( [
'apiKey' => $apiKey,
'apiSecret' => $apiSecret,
'signingKey' => $signingKey,
'baseUrl' => 'https://api.engagespot.co/v3' // optional
]);
OR
// Create an instance of EngagespotClient
$engagespot = new EngagespotClient($apiKey, $apiSecret);
$enagagespot->setSigningKey($signingKey);
// Create JWT token for user
$userIdentifier = '[email protected]';
$token = $engagespot->generateUserToken($userIdentifier);
// Use the generated token as needed
var_dump($token);
use Engagespot\EngagespotClient;
// Your Engagespot API credentials
$apiKey = 'your-api-key';
$apiSecret = 'your-api-secret';
// Create an instance of EngagespotClient
$client = new EngagespotClient($apiKey, $apiSecret);
use Engagespot\EngagespotClient;
// Your Engagespot API credentials
$apiKey = 'your-api-key';
$apiSecret = 'your-api-secret';
// Create an instance of EngagespotClient
$client = new EngagespotClient($apiKey, $apiSecret);
use Engagespot\EngagespotClient;
// Your Engagespot API credentials
$apiKey = 'your-api-key';
$apiSecret = 'your-api-secret';
$dataRegion = 'us'; // Optional
// Create an instance of EngagespotClient
$client = new EngagespotClient($apiKey, $apiSecret);