“A hackathon, a hacker neologism, is an event when programmers meet to do collaborative computer programming.” -Wikipedia
Note: Hackathon definition
Slack is a team communication tool, that makes collaboration and messaging easy.
- Channels
- Direct Messages
- Share files
- Search
Integration
- A cool project to learn something new!
- Very helpful for those that use Slack as their primary form of communication
Slackbots are useful bots that can be programmed to fufill a multitude of functions
- Be the HR representative and answer common questions
- Personal secretary for reminders, deadlines, and possibly
- Respond to custom messages
- Link users to integrated applications
- Node.js - "Node.js is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side."-Wikipedia
- JavaScript - "JavaScript (JS) is a lightweight interpreted or Just In Time-compiled programming language with first-class functions."
Open the terminal
- To install node
brew install node
- To see if Node is installed
node -v
- To see if NPM is installed
npm -v
Note: How to install Node and NPM
Go to the link provided
- Create a package.json file
npm init
- Create a new file called
index.js
touch index.js
- Add print statement to your index.js file
console.log('Hello World');
- Run your application!
node index.js
Note: Create a hello world node project
- Install dependencies in the node module
npm install express
- Print Hello World in your browser
var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send('Hello World')
})
app.listen(3000)
Note: Create a hello world node project that runs on a server
- Run your application!
node index.js
- In your browser go to
Note: Test Application
- Provides Node-Style Callbacks
RTMandWebAPI
- Powerful Low Level API
- Allows you the creator to use parts of the API surface that you want to use without the entire payload.
- Methods match Slack's API documentation
- Install
npm install slack
Note: This Slack API is a thin wrapper
- Probably defined at the beginning of the file
var slack = require('slack');
var bot = slack.rtm.client();
Note: Obtains a username our of a user id
// start listening to the slack team associated to the token
bot.listen({token:token})
// on RTM message event
bot.message(function(msg){
var name = 'thumbsup'; // Select Emoji
var channel = msg.channel; // Grab the channel the message was received from
var timestamp = msg.ts // Grab the timestamp of the message
var params = {token, name, channel, timestamp} // create a parameter object
slack.reactions.add(params, (err, data) => { // Use Slack Web API Node Style
if(err){
console.log("Error: ",err); // Will Print Error
} else {
console.log("Success: Added Reaction"); // Will Print Success
}
});
});
Note: Obtains a username our of a user id ** Change the font size on this slide...
- npm Documentation
- Slack Github
Note: Haiden ~~~ Resources and Documentation
- Uploading can be tricky, node-slack-upload makes it easy!
- Provides support for multipart and content variables
- Install
npm install node-slack-upload
Note: Haiden
- Probably defined at the beginning of the file
var Slack_Upload = require('node-slack-upload');
var fs = require('fs');
var _upLoader = new Slack_Upload(token);
Note: Haiden
_upLoader.uploadFile({
file: fs.createReadStream('file_path'), // open a File
channels: message.channel // the channel id you with to upload too
}, function(err, data) { // callback
if (err) {
console.error(err); // error happened
}
else {
console.log('Successfully uploaded files'); // success
}
});
Note: Haiden
- npm Documentation
- node-slack-upload Github
Note: Haiden ~~~ Resources and Documentation
- Botkit is a simple library to build bots for slack.
- Very simple to use.
- Botkit is node based and it allows to utilize any node package to get any functionality.
- Botkit allows you to hear, reply, and have multi-message conversations.
Herokuis a great container based cloud platform for node applications.- Using
Hekoku, we will be able focus on the development of our applications instead of worrying about our lack of infrastructure - Heroku
- Heroku Setup
- Useful Documentation that will help
- Botkit Conversation
- Working with Slack Integrations
-
Download Visual Studio Code
-
Download Atom
Thank you.
Note: speaker notes FTW!

