https://github.com/geoffdutton/iterable-api
NodeJS library to interact with the iterable.com API.
https://github.com/geoffdutton/iterable-api
Last synced: about 1 year ago
JSON representation
NodeJS library to interact with the iterable.com API.
- Host: GitHub
- URL: https://github.com/geoffdutton/iterable-api
- Owner: geoffdutton
- License: mit
- Created: 2019-03-13T18:20:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-06T09:56:03.000Z (almost 2 years ago)
- Last Synced: 2024-11-09T10:49:06.400Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 1.52 MB
- Stars: 7
- Watchers: 2
- Forks: 7
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Node Iterable API
[](https://standardjs.com)
[](https://github.com/geoffdutton/iterable-api/actions/workflows/nodejs.yml)
[](https://coveralls.io/github/geoffdutton/iterable-api?branch=master)
[](https://badge.fury.io/js/node-iterable-api)
[](https://snyk.io/test/github/geoffdutton/iterable-api)
Credit: [seanmcgary/iterable](https://github.com/seanmcgary/iterable)
### Install
```
npm install node-iterable-api
```
### Example
```javascript
const client = require('node-iterable-api').create('')
return client.lists.get()
.then(res => {
console.log(res.lists)
})
.catch(err => {
console.log(err)
})
```
### Resources
All resources are taken from those available in the [Iterable API documentation](https://app.iterable.com/api/docs).
**Note**: Not all resources are implemented yet. You can see which ones in `lib/api.js`.
Resources are addressable by calling:
```javascript
// If param is a string, it'll append it to the resource path
// Otherwise you can just past an object that will either be
// passed to the body on a POST/PUT request, or as query
// string params in the case of a GET request
iterableInstance[][](param[, payload])
// e.g. to get lists:
iterableInstace.lists.get()
.then(data => {
// data response
})
// e.g. bulk update users
iterableInstace.users.bulkUpdate({
users: [
{
email: 'foo@bar.com',
dataFields: {
// some data fields
},
userId: "someUserId"
}
]
})
```
Currently implemented resources are as follows:
```
lists
GET - /lists
POST - /lists
DELETE - /lists
GET - /lists/getUsers
POST - /lists/subscribe
POST - /lists/unsubscribe
events
GET - /events
POST - /events/track
POST - /events/trackBulk
POST - /events/trackInAppOpen
POST - /events/trackInAppClick
POST - /events/trackWebPushClick
POST - /events/trackPushOpen
users
GET - /users
DELETE - /users
POST - /users/update
POST - /users/updateEmail
POST - /users/bulkUpdate
POST - /users/registerDeviceToken
POST - /users/updateSubscriptions
POST - /users/bulkUpdateSubscriptions
GET - /users/getFields
GET - /users/getSentMessages
POST - /users/disableDevice
inApp
GET - /inApp/getMessages
push
POST - /push/target
campaigns
POST - /campaigns/create
channels
GET - /channels
commerce
POST - /commerce/trackPurchase
POST - /commerce/updateCart
email
GET - /email/viewInBrowser
POST - /email/target
workflows
POST - /workflows/triggerWorkflow
sms
POST - /sms/target
webPush
POST - /webPush/target
messageTypes
GET - /messageTypes
experiments
GET - /experiments/metrics
catalogs
GET - /catalogs
POST - /catalogs
DELETE - /catalogs
catalogs.fieldMappings
GET - /catalogs/{catalogName}/fieldMappings
PUT - /catalogs/{catalogName}/fieldMappings
catalogs.items
GET - /catalogs/{catalogName}/items
PUT - /catalogs/{catalogName}/items
POST - /catalogs/{catalogName}/items
PATCH - /catalogs/{catalogName}/items
DELETE - /catalogs/{catalogName}/items
subscriptions
PUT - /subscriptions
subscriptions.user
PATCH - /subscriptions/{subscriptionGroup}/{subscriptionGroupId}/user
DELETE - /subscriptions/{subscriptionGroup}/{subscriptionGroupId}/user
```
### Development
To run the full tests with coverage:
```
npm test
```
To run test driven development:
```
npm run tdd
```
To list the implemented resources:
```
node index.js
```
### Contributors
- [julianmclain](https://github.com/julianmclain)
- [dpolivy](https://github.com/dpolivy)
- [blutter](https://github.com/blutter)