All Projects → Torchlite → autopilot-api

Torchlite / autopilot-api

Licence: MIT license
A third-party JavaScript wrapper for Autopilot's REST API.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to autopilot-api

python-censusbatchgeocoder
A simple Python wrapper for U.S. Census Geocoding Services API batch service
Stars: ✭ 40 (+185.71%)
Mutual labels:  api-wrapper
FMT-Firmware
FMT Autopilot Embedded System
Stars: ✭ 207 (+1378.57%)
Mutual labels:  autopilot
nextcord
A Python wrapper for the Discord API forked from discord.py
Stars: ✭ 956 (+6728.57%)
Mutual labels:  api-wrapper
scala-weather
High-performance Scala library for looking up the weather
Stars: ✭ 45 (+221.43%)
Mutual labels:  api-wrapper
the-traveler
The Traveler is a small npm package which wraps around the Destiny 2 API.
Stars: ✭ 52 (+271.43%)
Mutual labels:  api-wrapper
node-fred
A Fred2 API wrapper
Stars: ✭ 16 (+14.29%)
Mutual labels:  api-wrapper
go-ovh
Simple go wrapper for the OVH API
Stars: ✭ 107 (+664.29%)
Mutual labels:  api-wrapper
pinboard.net
Fully featured API wrapper for pinboard.in
Stars: ✭ 21 (+50%)
Mutual labels:  api-wrapper
DPP
C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
Stars: ✭ 560 (+3900%)
Mutual labels:  api-wrapper
mOSD
modern OSD
Stars: ✭ 64 (+357.14%)
Mutual labels:  autopilot
asyncpixel
An Asyncronous Python wrapper for the Hypixel API.
Stars: ✭ 22 (+57.14%)
Mutual labels:  api-wrapper
wp-pgp-encrypted-emails
🔐 📧 Encrypts WordPress emails using OpenPGP or S/MIME with a familiar API.
Stars: ✭ 35 (+150%)
Mutual labels:  api-wrapper
rdfp
This R package connects the DoubleClick for Publishers API from R
Stars: ✭ 16 (+14.29%)
Mutual labels:  api-wrapper
roux
Simple and (a)synchronous Reddit API wrapper for Rust.
Stars: ✭ 41 (+192.86%)
Mutual labels:  api-wrapper
libopenTIDAL
TIDAL API interface written in ANSI C
Stars: ✭ 17 (+21.43%)
Mutual labels:  api-wrapper
gtmetrix-net
GTmetrix .Net client
Stars: ✭ 16 (+14.29%)
Mutual labels:  api-wrapper
api
Free Rest Webservices
Stars: ✭ 20 (+42.86%)
Mutual labels:  api-wrapper
PowerSchool-API
A Node.js library for interacting with the PowerSchool SIS API.
Stars: ✭ 21 (+50%)
Mutual labels:  api-wrapper
drip-php
An object-oriented PHP wrapper for Drip's API
Stars: ✭ 22 (+57.14%)
Mutual labels:  api-wrapper
SwiftFlyer
An API wrapper for bitFlyer.
Stars: ✭ 39 (+178.57%)
Mutual labels:  api-wrapper

autopilot-api

A third-party Node.js wrapper for Autopilot's REST API.

Example:

let Autopilot = require('autopilot-api');
let autopilot = new Autopilot('c5359558cf764d17bc49f13a87e8a56e');

let contact = { FirstName: 'Bob', LastName: 'Barker', Email: '[email protected]' };

autopilot.contacts.upsert(contact)
	.then(console.log)
	.catch(console.error);

Quick links:

Installation

npm install autopilot-api --save

Usage

Begin by initializing with your API key:

let Autopilot = require('autopilot-api');
let autopilot = new Autopilot('c5359558cf764d17bc49f13a87e8a56e');

Now you will be able to interact with Autopilot resources as described below.

Optionally you can pass an endpoint to use. This can be useful in testing if you want to call the sandbox api.

let Autopilot = require('autopilot-api');
let autopilot = new Autopilot('c5359558cf764d17bc49f13a87e8a56e', 'https://private-anon-5efcbf2622-autopilot.apiary-mock.com/v1');

Contacts

Upsert Contact

  • Method: autopilot.contacts.upsert(data[, callback])

  • Parameters:

    Name Type Required Description
    data object or array Yes The contact data to be upserted. If an array is provided, a bulk upsert is performed.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      let contact = { FirstName: 'Bob', LastName: 'Barker', Email: '[email protected]' };
    
      autopilot.contacts.upsert(contact)
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      let contact = { FirstName: 'Bob', LastName: 'Barker', Email: '[email protected]' };
    
      autopilot.contacts.upsert(contact, (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Get Contact

  • Method: autopilot.contacts.get(id[, callback])

  • Parameters:

    Name Type Required Description
    id string Yes Either the Autopilot contact_id or the contact's email address
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.contacts.get('[email protected]')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.contacts.get('[email protected]', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Delete Contact

  • Method: autopilot.contacts.delete(id[, callback])

  • Parameters:

    Name Type Required Description
    id string Yes Either the Autopilot contact_id or the contact's email address
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.contacts.delete('[email protected]')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.contacts.delete('[email protected]', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Unsubscribe Contact

  • Method: autopilot.contacts.unsubscribe(id[, callback])

  • Parameters:

    Name Type Required Description
    id string Yes Either the Autopilot contact_id or the contact's email address
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.contacts.unsubscribe('[email protected]')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.contacts.unsubscribe('[email protected]', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

List Custom Contact Fields

  • Method: autopilot.contacts.fields([callback])

  • Parameters:

    Name Type Required Description
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.contacts.fields()
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.contacts.fields((err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Lists

List Lists

  • Method: autopilot.lists.list([callback])

  • Parameters:

    Name Type Required Description
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.lists.list()
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.lists.list((err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Insert List

  • Method: autopilot.lists.insert(name[, callback])

  • Parameters:

    Name Type Required Description
    name string Yes The name for a new list.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.lists.insert('Animal Rights Supporters')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.lists.insert('Animal Rights Supporters', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

List Contacts in List

  • Method: autopilot.lists.roster(id[, bookmark, callback])

  • Parameters:

    Name Type Required Description
    id string Yes The id of the list to query.
    bookmark string No If there are more contacts on the list than have been returned, the bookmark will allow you to access the next group of contacts.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.lists.roster('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.lists.roster('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', () => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Check if Contact is in List

  • Method: autopilot.lists.has(listId, contactId[, callback])

  • Parameters:

    Name Type Required Description
    listId string Yes The id of the list to query.
    contactId string Yes Either the Autopilot contact_id or the contact's email address.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.lists.has('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', '[email protected]')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.lists.has('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', '[email protected]', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Add Contact to List

  • Method: autopilot.lists.add(listId, contactId[, callback])

  • Parameters:

    Name Type Required Description
    listId string Yes The id of the list to query.
    contactId string Yes Either the Autopilot contact_id or the contact's email address.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.lists.add('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', '[email protected]')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.lists.add('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', '[email protected]', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Remove Contact from List

  • Method: autopilot.lists.remove(listId, contactId[, callback])

  • Parameters:

    Name Type Required Description
    listId string Yes The id of the list to query.
    contactId string Yes Either the Autopilot contact_id or the contact's email address.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.lists.remove('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', '[email protected]')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.lists.remove('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', '[email protected]', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Smart Segments

List Smart Segments

  • Method: autopilot.smartSegments.list([callback])

  • Parameters:

    Name Type Required Description
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.smartSegments.list()
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.smartSegments.list((err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

List Contacts in Smart Segment

  • Method: autopilot.smartSegments.roster(id[, bookmark, callback])

  • Parameters:

    Name Type Required Description
    id string Yes The id of the smart segment to query.
    bookmark string No If there are more contacts on the smart segment than have been returned, the bookmark will allow you to access the next group of contacts.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.smartSegments.roster('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.smartSegments.roster('contactlist_06444749-9C0F-4894-9A23-D6872F9B6EF8', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Journeys (via triggers)

Add Contact to Journey

  • Method: autopilot.journeys.add(triggerId, contactId[, callback])

  • Parameters:

    Name Type Required Description
    triggerId string Yes The id of the trigger associated with the Journey we're adding to.
    contactId string Yes Either the Autopilot contact_id or the contact's email address.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.lists.add('0001', '[email protected]')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.lists.add('0001', '[email protected]', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

List Journeys with Triggers

  • Method: autopilot.journeys.list([callback])

  • Parameters:

    Name Type Required Description
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.journeys.list()
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.journeys.list((err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Account

Get Account

  • Method: autopilot.account.get([callback])

  • Parameters:

    Name Type Required Description
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.account.get()
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.account.get((err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

REST Hooks

List REST Hooks

  • Method: autopilot.restHooks.list([callback])

  • Parameters:

    Name Type Required Description
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.restHooks.list()
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.restHooks.list((err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Register REST Hook

  • Method: autopilot.restHooks.register(event, targetUrl, [callback])

  • Parameters:

    Name Type Required Description
    event string Yes The event name that you wish to be told about.
    targetUrl string Yes The URL in your API which you want Autopilot to POST to when the event occurs.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.restHooks.register('contact_added', 'http://www.priceisright.com/tracking')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.restHooks.register('contact_added', 'http://www.priceisright.com/tracking', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      })
    

Unregister REST Hook

  • Method: autopilot.restHooks.unregister(hookId, [callback])

  • Parameters:

    Name Type Required Description
    hookId string Yes The id of the hook to unregister.
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.restHooks.unregister('hook_ED75BA78-2405-4564-B24C-F2B8F936C7C6')
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.restHooks.unregister('hook_ED75BA78-2405-4564-B24C-F2B8F936C7C6', (err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

Delete All REST Hooks

  • Method: autopilot.restHooks.deleteAll([callback])

  • Parameters:

    Name Type Required Description
    callback function No A callback function to be executed upon completion.
  • Promise example:

      autopilot.restHooks.deleteAll()
      	.then(console.log)
      	.catch(console.error);
    
  • Callback example:

      autopilot.restHooks.deleteAll((err, response) => {
      	if (err) {
      		return console.error(err, response);
      	}
    
      	console.log(response);
      });
    

License

Released under MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].