# irritable

> Iterable API request wrapper for client && node.js

Latest version **1.5.2** (published 2016-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install irritable
pnpm add irritable
yarn add irritable
bun add irritable
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.2 |
| Published | 2016-06-03 |
| First published | 2016-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | John Bauer |
| Maintainers | notjrbauer |
| Keywords | api, request, iterable, tracking, pineapple |

## Links

- npm: https://www.npmjs.com/package/irritable
- Homepage: https://github.com/notjrbauer/irritable/issues
- Issues: https://github.com/notjrbauer/irritable/issues
- npm.io page: https://npm.io/package/irritable

## Dependencies (6)

- [axios](https://npm.io/package/axios.md) ^0.9.1
- [url-join](https://npm.io/package/url-join.md) 0.0.1
- [assert-ok](https://npm.io/package/assert-ok.md) ^1.0.0
- [object-assign](https://npm.io/package/object-assign.md) ^4.0.1
- [is-my-json-valid](https://npm.io/package/is-my-json-valid.md) ^2.12.4
- [iterable-json-schema](https://npm.io/package/iterable-json-schema.md) ^1.2.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.5.2 (latest) — 2016-06-03
- 1.5.0 — 2016-06-03
- 1.4.0 — 2016-04-19
- 1.3.0 — 2016-04-08
- 1.2.5 — 2016-02-25
- 1.2.4 — 2016-02-24
- 1.2.3 — 2016-02-23
- 1.2.2 — 2016-02-16
- 1.2.1 — 2016-02-16
- 1.2.0 — 2016-02-16
- 1.1.3 — 2016-02-16
- 1.1.2 — 2016-02-16
- 1.1.1 — 2016-02-16
- 1.1.0 — 2016-02-16
- 1.0.0 — 2016-02-16

## README

# irritable

[![NPM][irritable-icon]][irritable-url]  
> [Iterable](https://iterable.com/) API request wrapper for client && node.js  


## Install

```sh
$ npm install irritable --save
```

## Usage

```js
// Send event to Iterable
var token = process.env.ITERABLE_TOKEN
var Irritable = require('irritable')({
    token: token //API Token
})

Irritable.Events.track({
  eventName: 'test',
  email: 'test@test.com'
}).then(console.log)

```

## TODO
- [X] [Add events](https://app.iterable.com/api/docs#!/events) 
- [ ] [Add Lists](https://app.iterable.com/api/docs#!/lists)  
- [ ] [Add users](https://app.iterable.com/api/docs#!/users)  
- [ ] [Add push](https://app.iterable.com/api/docs#!/push)  
- [ ] [Add sms](https://app.iterable.com/api/docs#!/sms)  
- [ ] [Add campaigns](https://app.iterable.com/api/docs#!/campaigns)  
- [ ] [Add commerce](https://app.iterable.com/api/docs#!/commerce)  
- [ ] [Add email](https://app.iterable.com/api/docs#!/email)  
- [ ] [Add export](https://app.iterable.com/api/docs#!/export)  
- [ ] [Add workflows](https://app.iterable.com/api/docs#!/workflows)  

## 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:
```js
{
  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.

[irritable-icon]: https://nodei.co/npm/irritable.png?downloads=true
[irritable-url]: https://npmjs.org/package/irritable

---
_Source: https://npm.io/package/irritable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
