hackhands v3.7.2
Pluralsight Mentor - JS SDK
This codebase can be used in server-side (node) and client-side (Browser)
Modules
Constructor
Responsible to initialize a new instance of the SDK. You can use multiple instances in the same app/process. Check the full documentation under docs/Constructor.md
Authentication
Responsible for authenticate a instance in correct user (mentor or student).
Multiple methods are available, check the full documentation under docs/Authentication.md
Notifications
This module allows a mentor to listen for new requests in realtime.
Check the full documentation under docs/Notification.md
Session
Module responsible for everything that happens inside the session environment.
Some functionalities include Pause/Resume/Close a session and send messages via Chat system. Check the full documentation under docs/Session.md
Api
Generic module that allows to fetch and set data on the Mentor API.
Check the full documentation under docs/Api.md
Real world examples
Basic usage
// Set your settings to initiate a SDK instance
var settings = {
debug: 'false',
environment: 'stage'
}
var HH = HHSDK(settings);
Listen for new requests and send to a slack channel
var HH = require('HHSDK')()
// Authenticate using a expert token
HH.authentication.token('4bbc662534c0e881...c5e1')
HH.notifications.on('session:available', function(session){
// Create a payload to send to slack
var slackPayload = JSON.stringify({
"icon_url": session.issue.author.profile_thumb.large,
"username": session.issue.author.name + '',
"text": "[*_"+session.issue.department.title + "_*] `"+session.issue.title+"`\n"+session.issue.description+"\n\n <https://hackhands.com/session/"+session.issue.key+"/| :computer: Connect to this session>"
});
// Send to slack
require('request').post('https://hooks.slack.com/yourKey').form({payload: slackPayload})
});
8 years ago