1.1.0 • Published 8 months ago

sendx-javascript-sdk v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

SendX JavaScript SDK npm version

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 = "jane@doe.com";
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

ClassMethodHTTP requestDescription
sendx.CampaignApicreateCampaignPOST /campaignCreate Campaign
sendx.CampaignApideleteCampaignDELETE /campaign/{campaignId}Delete Campaign
sendx.CampaignApieditCampaignPUT /campaign/{campaignId}Edit Campaign
sendx.CampaignApigetAllCampaignsGET /campaignGet All Campaigns
sendx.CampaignApigetCampaignByIdGET /campaign/{campaignId}Get Campaign By Id
sendx.ContactApicreateContactPOST /contactCreate a contact
sendx.ContactApideleteContactDELETE /contact/{identifier}Delete Contact
sendx.ContactApigetAllContactsGET /contactGet All Contacts
sendx.ContactApigetContactByIdGET /contact/{identifier}Get Contact by Identifier
sendx.ContactApiunsubscribeContactPOST /contact/unsubscribe/{identifier}Unsubscribe Contact
sendx.ContactApiupdateContactPUT /contact/{identifier}Update Contact
sendx.EventApicreateRevenueEventPOST /events/revenueRecord a revenue event for a specific contact
sendx.EventApipushCustomEventPOST /events/customPush a custom event associated with a contact
sendx.GettingStartedApiidentifyContactPOST /contact/identifyIdentify contact
sendx.GettingStartedApitrackingContactPOST /contact/trackAdd Tracking info
sendx.ListApicreateListPOST /listCreate List
sendx.ListApideleteListDELETE /list/{listId}Delete List
sendx.ListApigetAllListsGET /listGet All Lists
sendx.ListApigetListByIdGET /list/{listId}Get List
sendx.ListApiupdateListPUT /list/{listId}Update List
sendx.ReportsApigetCampaignReportGET /report/campaign/{campaignId}Get CampaignReport Data
sendx.SenderApicreateSenderPOST /senderCreate Sender
sendx.SenderApigetAllSendersGET /senderGet All Senders
sendx.TagsApicreateTagPOST /tagCreate a Tag
sendx.TagsApideleteTagDELETE /tag/{tagId}Delete a Tag
sendx.TagsApigetAllTagsGET /tagGet All Tags
sendx.TagsApigetTagByIdGET /tag/{tagId}Get a Tag by ID
sendx.TagsApiupdateTagPUT /tag/{tagId}Update a Tag

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

apiKeyAuth

  • Type: API key
  • API key parameter name: X-Team-ApiKey
  • Location: HTTP header
1.1.0

8 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago