1.1.0 • Published 5 years ago

@thaoms/engage-js-api v1.1.0

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
5 years ago

engage-js-api

Engage JS API is a package that delivers some easy to use methods to access our api from your Node.js application.

Note that you'll have to handle the authentication flow by yourself.

This code is written in ES6+ and uses a lot of newer features, transpiling and compiling are up to you if you use the /src folder.

This plugin requires a Http Client, so we made one for your convenience but you are free to implement one for yourself.

https://github.com/thaoms/engage-js-httpclient-axios

Installation

npm install @thaoms/engage-js-api

Usage

/** CJS (transpiled version) **/
import EngageApi from "@thaoms/engage-js-api";
import HttpClientAxios from "@thaoms/engage-js-httpclient-axios";

/** Recommended (ES6 version, up to your build process) **/
import EngageApi from "@thaoms/engage-js-api/src";
import HttpClientAxios from "@thaoms/engage-js-httpclient-axios/src";


/* Step 1 */
const authorizationUrl = EngageApi.getAuthorizationUrl({
    clientId: 'client_id',
    scope: ['accounts_read', 'accounts_write'],
});

/* handle request and response */
/* ... */

/* Step 2 */
const tokenUrl = EngageApi.getAuthorizationTokenUrl({
    clientId: 'client_id',
    clientSecret: 'client_secret',
    code: 'code_you_got_from_step1',
});

/* handle request response */
/* ... */

const engageApi = new EngageApi(
    new HttpClientAxios(),
    'access_token_you_got_from_step2'
);

/** see the developers docs for available endpoints, 
params and more  **/

engageApi.getUsersForAccount('account_id', 20)
    .then((result) => {
        console.log(result);
    }).catch((e) => {
        console.log(e);
    });

Docs

Full documentation: https://developers.engagor.com/documentation

Docs for this package can also be compiled by yourself with $ npm run docs

Contributing

Feel free to open an issue.

License

BSD-2-Clause

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.10.0

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.1.0

5 years ago