0.8.0 • Published 2 years ago
@torontopubliclibrary/slack-helper v0.8.0
slack-helper
Using deploy notifications class
find the following credentials under your Slack app, use the same options for SlackHelper
const notification = new DeployNotifications({
token: '123abc', // required
signingSecret: '123abc', // required
channel_name: 'widgets-project', // required
app_id: '123abc' // required
});use helper classes in this library
SlackHelper, DBHelper
first initialize them by calling new on them:
const slackHelper = new SlackHelper( ... )SlackHelper
DBHelper (Database Helper)
This class is a named a more broadly than its use- the main use of this class is to aid in data persistence between Slack calls.
make sure to always call
dbHelper.db.destroy()after your actions to close the db connection.
initiate using:
const dbHelper = new DBHelper();DBHelper automatically creates a messages table on a sqlite database that looks like this:
{
"commit": string,
"ts": string
}All getter/setter methods onDBHelper use commit to fetch table data or set table data.
Methods include: del, add, first