sendx-javascript-sdk
v1.0.5
Published
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
Downloads
399
Maintainers
Readme
SendX JavaScript SDK
Introduction
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.
Installation
For Node.js
npm
Then install it via npm:
npm install sendx-javascript-sdk --save
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Getting Started
Please follow the installation instruction and execute the following JS code:
import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: apiKeyAuth
let apiKeyAuth = defaultClient.authentications['apiKeyAuth'];
apiKeyAuth.apiKey = 'YOUR API KEY';
let apiInstance = new sendx.ContactApi(); // ContactApi |
let contactRequest = new sendx.ContactRequest(); // ContactRequest |
contactRequest.email = "[email protected]";
contactRequest.firstName = "Jane";
contactRequest.lastName = "Doe";
contactRequest.company = "Tech Solutions Inc.";
contactRequest.lastTrackedIp = "34.94.159.140";
contactRequest.customFields = { "1231nfenife213": "VIP", "1434bife23bfij32": "Special Offer Subscriber" };
contactRequest.lists = ["234b324bjed32", "234bij3e2eyv3v2i"];
contactRequest.tags = ["234bijn2ei2jbu4", "2342bijhb2ijneni"];
apiInstance.createContact(contactRequest).then((data) => {
console.log('API called successfully. Contact created: ' + JSON.stringify(data, null, 2));
}, (error) => {
console.error(error);
});
Documentation for API Endpoints
All URIs are relative to https://api.sendx.io/api/v1/rest
Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- sendx.CampaignApi | createCampaign | POST /campaign | Create Campaign sendx.CampaignApi | deleteCampaign | DELETE /campaign/{campaignId} | Delete Campaign sendx.CampaignApi | editCampaign | PUT /campaign/{campaignId} | Edit Campaign sendx.CampaignApi | getAllCampaigns | GET /campaign | Get All Campaigns sendx.CampaignApi | getCampaignById | GET /campaign/{campaignId} | Get Campaign By Id sendx.ContactApi | createContact | POST /contact | Create a contact sendx.ContactApi | deleteContact | DELETE /contact/{contactId} | Delete Contact sendx.ContactApi | getAllContacts | GET /contact | Get All Contacts sendx.ContactApi | getContactById | GET /contact/{contactId} | Get Contact by ID sendx.ContactApi | unsubscribeContact | POST /contact/unsubscribe/{contactId} | Unsubscribe Contact sendx.ContactApi | updateContact | PUT /contact/{contactId} | Update Contact sendx.ListApi | createList | POST /list | Create List sendx.ListApi | deleteList | DELETE /list/{listId} | Delete List sendx.ListApi | getAllLists | GET /list | Get All Lists sendx.ListApi | getListById | GET /list/{listId} | Get List sendx.ListApi | updateList | PUT /list/{listId} | Update List sendx.ReportsApi | getCampaignReport | GET /report/campaign/{campaignId} | Get CampaignReport Data sendx.SenderApi | createSender | POST /sender | Create Sender sendx.SenderApi | getAllSenders | GET /sender | Get All Senders sendx.TagsApi | createTag | POST /tag | Create a Tag sendx.TagsApi | deleteTag | DELETE /tag/{tagId} | Delete a Tag sendx.TagsApi | getAllTags | GET /tag | Get All Tags sendx.TagsApi | getTagById | GET /tag/{tagId} | Get a Tag by ID sendx.TagsApi | updateTag | PUT /tag/{tagId} | Update a Tag
Documentation for Models
- sendx.Campaign
- sendx.CampaignDashboardData
- sendx.CampaignRequest
- sendx.Contact
- sendx.ContactRequest
- sendx.CreateResponse
- sendx.DashboardStats
- sendx.DeleteCampaign200Response
- sendx.DeleteRequest
- sendx.DeleteResponse
- sendx.LastSentCampaignStat
- sendx.ListModel
- sendx.ListRequest
- sendx.ReportData
- sendx.Response
- sendx.Sender
- sendx.SenderRequest
- sendx.SenderResponse
- sendx.Tag
- sendx.TagRequest
Documentation for Authorization
Authentication schemes defined for the API:
apiKeyAuth
- Type: API key
- API key parameter name: X-Team-ApiKey
- Location: HTTP header