Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A Slash WebTask for Slack to run a build on Shippable
var request=require('request');
module.exports = function (ctx, cb) {
var shippable_secret=ctx.secrets.shippable; // API token for shippable API
var project=ctx.body.text; // project name passed as parameter to Slash command
// do not want to look up the project id in code; create dictionary here
var projects={
realtime: '<Shippable project id>'
// check if user specifies a correct project
if(!projects[project]) {
cb(null, {
response_type: 'in_channel',
text: 'Sorry, specify a valid project!'
// call shippable API to build project
var options = {
method: 'POST',
url: '' + projects[project] + '/newBuild',
headers: {
'Authorization': 'apiToken ' + shippable_secret
// we do not specify a callback or do error checking; user should check if he gets a build report in Slack
cb(null, {
response_type: 'in_channel',
text: 'Build request for ' + project + ' fired! Check Slack for status.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.