SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations.
The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
The SendX Rest API doesn’t support bulk updates. You can work on only one object per request.
PHP 7.4 and later. Should also work with PHP 8.0.
To install the bindings via Composer, use the following command on the command line:
composer require sendx/sendx-php-sdk
Or, add the following to composer.json
:
"require": {
"sendx/sendx-php-sdk": "1.0.0"
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/sendx/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apiKeyAuth
$config = sendx\Configuration::getDefaultConfiguration()->setApiKey('X-Team-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = sendx\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Team-ApiKey', 'Bearer');
$apiInstance = new sendx\Api\ContactApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$contact_request = new \sendx\model\ContactRequest(); // \sendx\model\ContactRequest
$contact_request->setEmail("john@doe.com"); // Required: Set email
$contact_request->setFirstName("John"); // Optional: Set first name
$contact_request->setLastName("Doe"); // Optional: Set last name
$contact_request->setCompany("SendX"); // Optional: Set company
$contact_request->setLastTrackedIp("192.168.1.1"); // Optional: Set last tracked IP
$contact_request->setCustomFields(["sendf13kn2k3kjm2d" => "Developer", "ckjsnck234nm2kn42" => "Engineering"]); // Optional: Set custom fields
$contact_request->setLists(["list_id_1", "list_id_2"]); // Optional: Subscribe to lists
try {
$result = $apiInstance->createContact($contact_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ContactApi->createContact: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://api.sendx.io/api/v1/rest
Class | Method | HTTP request | Description |
---|---|---|---|
CampaignApi | createCampaign | POST /campaign | Create Campaign |
CampaignApi | deleteCampaign | DELETE /campaign/{campaignId} | Delete Campaign |
CampaignApi | editCampaign | PUT /campaign/{campaignId} | Edit Campaign |
CampaignApi | getAllCampaigns | GET /campaign | Get All Campaigns |
CampaignApi | getCampaignById | GET /campaign/{campaignId} | Get Campaign By Id |
ContactApi | createContact | POST /contact | Create a contact |
ContactApi | deleteContact | DELETE /contact/{identifier} | Delete Contact |
ContactApi | getAllContacts | GET /contact | Get All Contacts |
ContactApi | getContactById | GET /contact/{identifier} | Get Contact by Identifier |
ContactApi | unsubscribeContact | POST /contact/unsubscribe/{identifier} | Unsubscribe Contact |
ContactApi | updateContact | PUT /contact/{identifier} | Update Contact |
EventApi | createRevenueEvent | POST /events/revenue | Record a revenue event for a specific contact |
EventApi | pushCustomEvent | POST /events/custom | Push a custom event associated with a contact |
GettingStartedApi | identifyContact | POST /contact/identify | Identify contact |
GettingStartedApi | trackingContact | POST /contact/track | Add Tracking info |
ListApi | createList | POST /list | Create List |
ListApi | deleteList | DELETE /list/{listId} | Delete List |
ListApi | getAllLists | GET /list | Get All Lists |
ListApi | getListById | GET /list/{listId} | Get List |
ListApi | updateList | PUT /list/{listId} | Update List |
ReportsApi | getCampaignReport | GET /report/campaign/{campaignId} | Get CampaignReport Data |
SenderApi | createSender | POST /sender | Create Sender |
SenderApi | getAllSenders | GET /sender | Get All Senders |
TagsApi | createTag | POST /tag | Create a Tag |
TagsApi | deleteTag | DELETE /tag/{tagId} | Delete a Tag |
TagsApi | getAllTags | GET /tag | Get All Tags |
TagsApi | getTagById | GET /tag/{tagId} | Get a Tag by ID |
TagsApi | updateTag | PUT /tag/{tagId} | Update a Tag |
- Campaign
- CampaignDashboardData
- CampaignRequest
- Contact
- ContactRequest
- CreateResponse
- CustomEventRequest
- DashboardStats
- DeleteCampaign200Response
- DeleteRequest
- DeleteResponse
- EventResponse
- IdentifyRequest
- IdentifyResponse
- LastSentCampaignStat
- ListModel
- ListRequest
- ReportData
- Response
- RevenueEventRequest
- Sender
- SenderRequest
- SenderResponse
- Tag
- TagRequest
- TrackRequest
- TrackResponse
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: X-Team-ApiKey
- Location: HTTP header
To run the tests, use:
composer install
vendor/bin/phpunit