irritable
Iterable API request wrapper for client && node.js
Install
$ npm install irritable --save
Usage
var token = process.env.ITERABLE_TOKEN
var Irritable = require('irritable')({
token: token
})
Irritable.Events.track({
eventName: 'test',
email: 'test@test.com'
}).then(console.log)
TODO
API
irritable(options)
-> object
options
token
Required
Type: string
or process.env.ITERABLE_TOKEN
Token / key used to communicate with Iterable API
baseURL
Optional
Type: string
Default: http://api.iterable.com/api/
Base URL of iterable api.
timeout
Optional
Type: number
Default: 3000 ms
Timeout of request life sent to iterable
responseType
Optional
Type: string
Default: json
Response type sent back from iterable
irritable.Events
-> object
returns event handler object:
{
track: <fn>,
trackPushOpen: <fn>,
trackConversion: <fn>
}
irritable.Events.track(eventObject)
-> promise
Sends a validated event object to Iterable.
eventObject
email
optional
Type: string
Email associated with the event.
eventName
required
Type: string
eventName associated with the event.
createdAt
optional
Type: string
date / unix timestamp of the associated event.
dataFields
optional
Type: object
Metadata for the event.
campaignId
optional
Type: number
campaignId of the event.
templateId
optional
Type: number
templateId of the event.
irritable.Events.trackConversion(eventObject)
-> promise
Sends a validated trackConversion event object to Iterable.
eventObject
email
required
Type: string
Email associated with the event.
campaignId
required
Type: number
campaignId of the event.
createdAt
optional
Type: string
date / unix timestamp of the associated event.
dataFields
optional
Type: object
Metadata for the event.
templateId
optional
Type: number
templateId of the event.
irritable.Events.trackPushOpen(eventObject)
-> promise
Sends a validated trackPushOpen event object to Iterable.
eventObject
email
required
Type: string
Email associated with the event.
userId
required
Type: string
UserId associated with the event.
campaignId
required
Type: number
campaignId of the event.
createdAt
optional
Type: string
date / unix timestamp of the associated event.
dataFields
optional
Type: object
Metadata for the event.
templateId
optional
Type: number
templateId of the event.