PHPackages                             engagespot/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. engagespot/php-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

engagespot/php-sdk
==================

This is the php library for Engagespot

v1.4.3(1y ago)54.2k↓100%1[1 issues](https://github.com/Engagespot/php/issues)MITPHPPHP ^7.0 || ^8.0

Since Jan 22Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Engagespot/php)[ Packagist](https://packagist.org/packages/engagespot/php-sdk)[ RSS](/packages/engagespot-php-sdk/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (10)Used By (0)

Engagespot PHP SDK
==================

[](#engagespot-php-sdk)

The Engagespot PHP SDK enables seamless integration and notification sending via the Engagespot API in PHP applications. Engagespot provides a unified platform for delivering targeted notifications to users through channels like in-app messages, web push, and email.

Installation
------------

[](#installation)

Install the Engagespot PHP SDK using [Composer](https://getcomposer.org/):

```
composer require engagespot/php-sdk
```

Getting Started
---------------

[](#getting-started)

### Step 1: Obtain API Credentials

[](#step-1-obtain-api-credentials)

Sign up for an account on [Engagespot](https://www.engagespot.co/) and acquire your API key and API secret.

### Step 2: Initialize EngagespotClient

[](#step-2-initialize-engagespotclient)

Include the Engagespot PHP SDK in your PHP code and create an instance of `EngagespotClient` with your API key, API secret, and signing key (if applicable):

here are examples of the two types of initializations for the `EngagespotClient`:

1. **Initialization with individual parameters:**

```
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);
```

In this example, the `EngagespotClient` is initialized with individual parameters for the API key, API secret.

2. **Initialization with an associative array:**

```
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);
```

In this example, the `EngagespotClient` is initialized with an associative array that includes the API key, API secret, signing key, and base URL.

Remember to replace `'your-api-key'`, `'your-api-secret'`, and `'your-signing-key'` with your actual Engagespot API credentials. The base URL is optional and defaults to '' if not provided. The signing key is also optional and can be omitted if not used.

Data Region
-----------

[](#data-region)

Data Region is an optional parameter that allows you to specify the region where the data is stored. The default region is `us`. Learn more about [Data Region](https://documentation.engagespot.co/docs/concepts/data-region).

- `dataRegion` (optional): Specify the region for data storage and processing. Available options:
    - `us`: US West region
    - `eu`: EU Central region

### Step 3: Sending a Notification

[](#step-3-sending-a-notification)

#### Sending a Notification

[](#sending-a-notification)

Prepare notification data and use the `send` method:

### Legacy Payload

[](#legacy-payload)

```
$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' => ['user3@example.com'],
    'category' => 'overrideCategory',
    'data' => [
        // custom data as you needed
        ],
    ],
];

$response = $engagespot->send($notificationData);

// Handle the response as needed
var_dump($response);
```

### Preferred Payload

[](#preferred-payload)

```
$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' => ['user1@example.com', 'user2@example.com'],
    ],
    'override' => [
        'channels' => ['inApp', 'webPush'],
        // other properties you want to override
    ],
];
```

### Sending the notification

[](#sending-the-notification)

```
 $response = $engagespot->send($notificationData);
```

### Create OR Update User

[](#create-or-update-user)

```
use Engagespot\EngagespotClient;

$identifier = 'johndoe@test.com'; // your unique identifier
$profile = [
    'email' => 'johndoe@test.com',
    'any_key' => 'any_value'
];

$engagespot = new EngagespotClient($apiKey, $apiSecret);
$enagagespot->createOrUpdateUser($identifier, $profile);
```

You can add any keyvalue pairs to profile.

#### Generating User Token

[](#generating-user-token)

Generate a JWT token for a user for authentication:

Note : Remember that for generating user token you must need to Initialize engagespot via associative array OR by

```
$enagagespot->setSigningKey($signingKey);
```

because signingKey is required for generating user tokens

```
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 = 'testuser@example.com';
$token = $engagespot->generateUserToken($userIdentifier);

// Use the generated token as needed
var_dump($token);
```

### Creating Signing Key

[](#creating-signing-key)

You can generate your public-private signing key pair from Engagespot console, and this private key should be the secret signing key for generating user tokens

[![signing_key-71ae93037d6197a7db8a1894c2293079](https://private-user-images.githubusercontent.com/129726530/315901421-6dfe590a-fd57-4ef0-a0b7-83cee8470538.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQxODY1NjgsIm5iZiI6MTc3NDE4NjI2OCwicGF0aCI6Ii8xMjk3MjY1MzAvMzE1OTAxNDIxLTZkZmU1OTBhLWZkNTctNGVmMC1hMGI3LTgzY2VlODQ3MDUz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YzQ2M2ViYzdhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.3eyM32t3nIJjpcjapVqG-QoMpFOb0_UGyO9LquAaNMA)NOTE: When you generate the signing key, Engagespot will store **only** the public key in our database. You should download the private key and use it for signing your user tokens. You won't be able to retrieve the private key after this step.

### Additional Configuration

[](#additional-configuration)

Set additional configuration options if needed:

```
$engagespot->setConfig('additionalConfig', 'value');
```

You can set SigningKey after initializing `EngagespotClient` by

```
$signingKey = 'your-signing-key';
$enagagespot->setSigningKey($signingKey);
```

### Managing In-App Inbox Notifications

[](#managing-in-app-inbox-notifications)

In-app inbox notifications are messages that users can view within your application. Here's how you can manage them using the EngagespotClient:

#### 1. Initialization

[](#1-initialization)

Before you can interact with the in-app inbox notifications, you need to initialize the EngagespotClient with your API credentials:

```
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);
```

#### 2. Fetching In-App Notifications

[](#2-fetching-in-app-notifications)

You can fetch in-app notifications for a specific user. This retrieves a list of notifications from the in-app inbox.

```
$client->inapp()->fetch('john_doe_123', 1, 10);
```

- `userIdentifier`: The identifier of the user whose notifications you want to fetch.
- `pageNo` (optional): Page number of the notifications (default is 1).
- `limit` (optional): Maximum number of notifications per page (default is 10).

#### 3. Marking a Notification as Read

[](#3-marking-a-notification-as-read)

You can mark a notification as read once the user has viewed it.

```
$client->inapp()->markNotificationAsRead('notification_123');
```

- `notificationId`: The ID of the notification to mark as read.

#### 4. Marking a Notification as Unseen

[](#4-marking-a-notification-as-unseen)

You can mark a notification as unseen to indicate that it hasn't been viewed by the user yet.

```
$client->inapp()->markNotificationAsUnseen('notification_123');
```

- `notificationId`: The ID of the notification to mark as unseen.

#### 5. Marking a Notification as Unread

[](#5-marking-a-notification-as-unread)

You can mark a notification as unread if the user has viewed it but hasn't interacted with it in a meaningful way.

```
$client->inapp()->markNotificationAsUnread('notification_123');
```

- `notificationId`: The ID of the notification to mark as unread.

#### 6. Deleting a Notification

[](#6-deleting-a-notification)

You can delete a notification from the in-app inbox if it's no longer relevant.

```
$client->inapp()->deleteNotification('notification_123');
```

- `notificationId`: The ID of the notification to delete.

---

### Managing Topics

[](#managing-topics)

Topics allow you to organize users into groups based on their interests or preferences. Here's how you can manage topics using the EngagespotClient:

#### 1. Initialization

[](#1-initialization-1)

Before you can interact with topics, you need to initialize the EngagespotClient with your API credentials:

```
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);
```

#### 2. Creating a Topic

[](#2-creating-a-topic)

You can create a new topic with a name and an optional identifier. If an identifier is not provided, it will be generated from the name.

```
$client->topics()->create('New Topic', 'new-topic');
```

- `name`: The name of the topic.
- `identifier` (optional): The identifier of the topic. If not provided, it will be generated from the name.

#### 3. Updating a Topic

[](#3-updating-a-topic)

You can update the name of an existing topic.

```
$client->topics()->update(123, 'Updated Topic Name');
```

- `topicId`: The ID of the topic to update.
- `name`: The new name for the topic.

#### 4. Deleting a Topic

[](#4-deleting-a-topic)

You can delete a topic.

```
$client->topics()->delete(123);
```

- `topicId`: The ID of the topic to delete.

#### 5. Subscribing Users to a Topic

[](#5-subscribing-users-to-a-topic)

You can subscribe users to a topic.

```
$users = [
    ['identifier' => 'user1', 'channels' => ['web']],
    ['identifier' => 'user2', 'channels' => ['email', 'push']],
];

$client->topics()->subscribeUser(123, $users);
```

- `topicId`: The ID of the topic to subscribe users to.
- `users`: An array of user objects to subscribe. Each user object should have an identifier and channels.

#### 6. Unsubscribing Users from a Topic

[](#6-unsubscribing-users-from-a-topic)

You can unsubscribe users from a topic.

```
$users = ['user1', 'user2'];

$client->topics()->unsubscribeUser(123, $users);
```

- `topicId`: The ID of the topic to unsubscribe users from.
- `users`: An array of user identifiers to unsubscribe.

#### 7. Updating Notification Channels for a User in a Topic

[](#7-updating-notification-channels-for-a-user-in-a-topic)

You can update the notification channels for a user in a topic.

```
$client->topics()->updateChannel('user1', 123, ['email', 'push']);
```

- `identifier`: The identifier of the user whose channels are to be updated.
- `topicId`: The ID of the topic.
- `channels`: An array of notification channels for the user.

#### 8. Listing Subscriptions of a User to All Topics

[](#8-listing-subscriptions-of-a-user-to-all-topics)

You can list the subscriptions of a user to all topics.

```
$client->topics()->listSubscriptionsOfUser('user1');
```

- `identifier`: The identifier of the user.

---

Workflows
---------

[](#workflows)

You can manage workflows using the EngagespotClient: currently, only the cancellation of a running workflow is supported.

### Initialization

[](#initialization)

Before you can interact with workflows, you need to initialize the EngagespotClient with your API credentials:

```
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);
```

### Cancel a running workflow

[](#cancel-a-running-workflow)

```
$cancellationData = [
    'cancellationKey' => 'cancellationValue',
    'cancelFor' => [
        'recipients' => ['identifierOne', 'identifierTwo']
    ]

];
$client->workflows()->cancelRun('workflowIdentifier', $cancellationData);
```

- `identifier`: The identifier of the workflow.
- `cancellationData`: The cancellation data.

Exceptions
----------

[](#exceptions)

The SDK throws `\InvalidArgumentException` for missing or invalid parameters during initialization or notification creation.

Note
----

[](#note)

Replace placeholder values such as `'your-api-key'`, `'your-api-secret'`, and `'your-signing-key'` with your actual Engagespot API credentials.

For detailed information about Engagespot API parameters, refer to the [Engagespot API documentation](https://documentation.engagespot.co/docs/rest-api#tag/Notifications).

Feel free to explore and contribute to the SDK!

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~48 days

Recently: every ~58 days

Total

7

Last Release

547d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/002981757095ab0e086b3627d3629f9a6f4a636ea1cff2d44de5be58d567dff7?d=identicon)[anands](/maintainers/anands)

---

Top Contributors

[![jobin-404](https://avatars.githubusercontent.com/u/129726530?v=4)](https://github.com/jobin-404 "jobin-404 (12 commits)")[![meanands](https://avatars.githubusercontent.com/u/2811568?v=4)](https://github.com/meanands "meanands (9 commits)")

### Embed Badge

![Health badge](/badges/engagespot-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/engagespot-php-sdk/health.svg)](https://phpackages.com/packages/engagespot-php-sdk)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
