Quick start
-
Install Node.JS on your computer.
-
Setup your project
Create a new Node.JS app :
$ mkdir myapp$ cd myapp$ npm init...Add node-piper as a dependency in your package.json
"dependencies":,Execute
npm install
in your current folder to fetch the dependenciesCreate an
index.js
file in myapp directory containing:var piper = ;var ACCESS_TOKEN = "IQ77NWUPUMNBYEUEKRTWU3VDR5YSLHTA"; // A unique access token to authenticate your requestconsole;var client ="name": "ACME Company""handle": "acme""slackToken": "xoxb-AB0923F-09LSDKFJWOFKLS-LKALIWE099""adminContact": "Martin Don""adminEmail": "mdon@acme.com"piper;piper;piper;piper;piper;piper;piper; -
Start your app
$ node index.jsResponse from Piper
Examples
API
registerClient
The registerClient
function registers a new client and activates a slack connection. The function takes 3 parameters:
access_token
: Your access token for authenticationclient
: JSON object with details of the client you want to registercallback(error, response)
: A callback function get 2 arguments:- An
error
when applicable - A JSON object containing the Piper response
- An
var piper = ;var client = "name": "ACME Company" "handle": "acme" "slackToken": "xoxb-AB0923F-09LSDKFJWOFKLS-LKALIWE099" "adminContact": "Martin Don" "adminEmail": "mdon@acme.com" piper;
connect
The connect
function creates a slack connection for a registered client. The function takes 3 arguments:
access_token
: Your access token for your instancehandle
: The unique slack handle of the clients slack instance .slack.comcallback(error, response)
: A callback function get 2 arguments:- An
error
when applicable - A JSON object containing the Piper response
- An
var piper = ;piper;
disconnect
The disconnect
function ends an active connection. The function takes 3 arguments:
access_token
: Your access token for your instancehandle
: The unique slack handle of the clients slack instance .slack.comcallback(error, response)
: A callback function get 2 arguments:- An
error
when applicable - A JSON object containing the Piper response
- An
var piper = ;piper;
getClient
The getClient
function retrieves the details of a registered client. The function takes 3 arguments:
access_token
: Your access token for your instancehandle
: The unique slack handle of the clients slack instance .slack.comcallback(error, response)
: A callback function get 2 arguments:- An
error
when applicable - A JSON object containing the Piper response
- An
var piper = ;piper;
getClients
The getClients
function retrieves an array of all registered clients. The function takes 2 arguments:
access_token
: Your access token for your instancecallback(error, response)
: A callback function get 2 arguments:- An
error
when applicable - A JSON object containing the Piper response
- An
var piper = ;piper;
getConnection
The getConnection
function retrieves the details of an active connection for a registered client. The function takes 3 arguments:
access_token
: Your access token for your instancehandle
: The unique slack handle of the clients slack instance .slack.comcallback(error, response)
: A callback function get 2 arguments:- An
error
when applicable - A JSON object containing the Piper response
- An
var piper = ;piper;
getConnections
The getConnections
function retrieves an array of all registered connections. The function takes 2 arguments:
access_token
: Your access token for your instancecallback(error, response)
: A callback function get 2 arguments:- An
error
when applicable - A JSON object containing the Piper response
- An
var piper = ;piper;