npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

send_x_rest_api_wrapper

v1.0.2

Published

NOTE_All_API_calls_contain_2_parameters___api_key_and_team_id__These_can_be_inferred_from_your_settings_page_httpsapp_sendx_iosetting_under_the_sections_Api_Key_and_Team_Id_respectively_For_checking_language_specific_Clients____Golang_httpsgithub_comsendx

Downloads

49

Readme

send_x_rest_api

SendXRestApi - NodeJS client for send_x_rest_api

NOTE: All API calls contain 2 parameters - 'api_key' and 'team_id'. These can be inferred from your settings page 'https://app.sendx.io/setting' under the sections 'Api Key' and 'Team Id' respectively.

For checking language specific Clients:

SendX REST API has two methods:

  • Identify
  • Track

Identify API Method

Identify API Method is used to attach data to a visitor.

  • If a contact is not yet created then we will create the contact.
  • In case contact already exists then we update it.

Example Request:

json { email: \"[email protected]\", firstName: \"John\", lastName: \"Doe\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\", \"Age\": \"27\", \"Experience\": \"5\" }, tags: [\"Developer\", \"API Team\"], }

  • Tags are an array of strings.
  • In case they don't exist previously then API will create them and associate them with the contact.
  • Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value.
  • In case custom field exists already then we simply update the value of it for the aforementioned contact. Custom Fields are associated with data types and which be created and edited inside the app.
  • If a custom field is not present inside the app and an API call is made containing it, a custom field with type 'string' is created and the value set.
  • For custom fields with data type 'number', values can be added to or subtracted from existing values. This can be done by using "++" or "--" operator before the number (e.g. "customField_name": "++34" would increase the value of existing "customField_name" in SendX for the contact.
  • If it doesn't already exist, the value '34' would be inserted for it).
  • We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like:

API Call A

json { email: \"[email protected]\", firstName: \"John\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\" }, tags: [\"Developer\"], }

API Call B

json { email: \"[email protected]\", customFields: { \"Age\": \"29\" }, tags: [\"API Team\"], }

Then the final contact will have firstName as John, birthday as 1989-03-03 present. Also both tags Developer and API Team shall be present along with custom fields Designation and Age.

Properties:

  • firstName: type string
  • lastName: type string
  • email: type string
  • newEmail: type string
  • company: type string
  • birthday: type string with format YYYY-MM-DD eg: 2016-11-21
  • customFields: type map[string]string
  • tags: type array of string

In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property.

Response:

json { \"status\": \"200\", \"message\": \"OK\", \"data\": { \"encryptedTeamId\": \"CLdh9Ig5GLIN1u8gTRvoja\", \"encryptedId\": \"c9QF63nrBenCaAXe660byz\", \"tags\": [ \"API Team\", \"Tech\" ], \"firstName\": \"John\", \"lastName\": \"Doe\", \"email\": \"[email protected]\", \"company\": \"\", \"birthday\": \"1989-03-03\", \"customFields\": { \"Age\": \"29\", \"Designation\": \"Software Engineer\" } } }

Track API Method

Track API Method is used to track a contact. In the track API object you can:

  • addTags
  • removeTags

You can have automation rules based on tag addition as well as tag removal and they will get executed Eg:

  • On user registration tag start onboarding drip for contact
  • Account Upgrade tag start add user to paid user list and start account expansion drip.
  • On removal of trial user tag start upsell trial completed users drip.

Example Request:

> \\_scq.push([\"track\", { \"addTags\": [\"blogger\", \"female\"] }]); > \\_scq.push([\"track\", { \"addTags\": [\"paid user\"], \"removeTags\": [\"trial user\"] }]); **Response:** > { \"status\": \"200\", \"message\": \"OK\", \"data\": \"success\" }


This SDK is automatically generated by the Swagger Codegen project:

  • API version: v1
  • Package version: v1
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install send_x_rest_api --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your send_x_rest_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('send_x_rest_api') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/YOUR_USERNAME/send_x_rest_api then install it via:

    npm install YOUR_USERNAME/send_x_rest_api --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, that's to say your javascript file where you actually use this library):

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:

var SendXRestApi = require('send_x_rest_api');

var api = new SendXRestApi.ContactApi()

var apiKey = "apiKey_example"; // {String} 

var teamId = "teamId_example"; // {String} 

var contactDetails = new SendXRestApi.ContactRequest(); // {ContactRequest} Contact details

var contactDetails.email = "[email protected]";
var contactDetails.firstName = "John";
var contactDetails.lastName = "Doe";
var contactDetails.birthday = "1989-03-03";
var contactDetails.customFields = {"Designation": "Software Engineer"};
var contactDetails.tags = ["Developer"];

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.contactIdentifyPost(apiKey, teamId, contactDetails, callback);

Documentation for API Endpoints

All URIs are relative to https://app.sendx.io/api/v1

Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- SendXRestApi.ContactApi | contactIdentifyPost | POST /contact/identify | Identify a contact as user SendXRestApi.ContactApi | contactTrackPost | POST /contact/track | Add tracking info using tags to a contact

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.