1.0.1 • Published 6 years ago

@pkehoe/slack-demo-app v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

slack-demo-app

Demo Apps Database Access Library By @paigekehoe Version: 0.0.0 Date: 10/19/18

Installation

npm install https://github.com/slack-demo-eng/slack-demo-app --save

Initial configuration

Initialize the database and start the connection

let AppDB = require('slack-demo-app')(DB_HOST, DB_USER, DB, DB_PW);

Writing to the database

After you've received the /install request from your app, parse the install as follows:

slack.send('oauth.access', { client_id: client_id, client_secret: client_secret, code: code })

  .then(function(res) {

    AppDB.install('APP NAME', res.team_id, auth, res.user_id)

}

Reading from the database

In order to get the auth_access value for a team and thus the xoxp or xoxb token, make the following request:

AppDB.lookup('APP NAME', body.team_id)

  .then(function (res) {

        let token = JSON.parse(auth[0].auth_access).access_token

  }