Skip to content

Commit

Permalink
remove studio features
Browse files Browse the repository at this point in the history
  • Loading branch information
benbrown committed Dec 20, 2018
1 parent fdb4c6b commit 9497da3
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 304 deletions.
6 changes: 1 addition & 5 deletions app.json
Expand Up @@ -3,7 +3,7 @@
"description": "A starting point for building custom Slack applications", "description": "A starting point for building custom Slack applications",
"repository": "https://github.com/howdyai/botkit-starter-slack", "repository": "https://github.com/howdyai/botkit-starter-slack",
"keywords": ["node", "bots", "slack","botkit"], "keywords": ["node", "bots", "slack","botkit"],
"website": "https://studio.botkit.ai/", "website": "https://botkit.ai/",
"success_url":"/", "success_url":"/",
"addons":[ "addons":[
{ {
Expand All @@ -17,10 +17,6 @@
}, },
"clientSecret": { "clientSecret": {
"description": "Client Secret provided by Slack" "description": "Client Secret provided by Slack"
},
"studio_token": {
"description": "Token associated with your bot in Botkit Studio",
"required":false
} }
} }
} }
24 changes: 9 additions & 15 deletions bot.js
Expand Up @@ -23,13 +23,9 @@ This bot demonstrates many of the core features of Botkit:
-> http://api.slack.com -> http://api.slack.com
Get a Botkit Studio token from Botkit.ai:
-> https://studio.botkit.ai/
Run your bot from the command line: Run your bot from the command line:
clientId=<MY SLACK TOKEN> clientSecret=<my client secret> PORT=<3000> studio_token=<MY BOTKIT STUDIO TOKEN> node bot.js clientId=<MY SLACK TOKEN> clientSecret=<my client secret> PORT=<3000> node bot.js
# USE THE BOT: # USE THE BOT:
Expand Down Expand Up @@ -97,15 +93,14 @@ if (!process.env.clientId || !process.env.clientSecret) {


webserver.get('/', function(req, res){ webserver.get('/', function(req, res){
res.render('installation', { res.render('installation', {
studio_enabled: controller.config.studio_token ? true : false,
domain: req.get('host'), domain: req.get('host'),
protocol: req.protocol, protocol: req.protocol,
glitch_domain: process.env.PROJECT_DOMAIN, glitch_domain: process.env.PROJECT_DOMAIN,
layout: 'layouts/default' layout: 'layouts/default'
}); });
}) })


var where_its_at = 'https://' + process.env.PROJECT_DOMAIN + '.glitch.me/'; var where_its_at = 'http://' + (process.env.PROJECT_DOMAIN ? process.env.PROJECT_DOMAIN+ '.glitch.me/' : 'localhost:' + process.env.PORT || 3000);
console.log('WARNING: This application is not fully configured to work with Slack. Please see instructions at ' + where_its_at); console.log('WARNING: This application is not fully configured to work with Slack. Please see instructions at ' + where_its_at);
}else { }else {


Expand Down Expand Up @@ -134,7 +129,7 @@ if (!process.env.clientId || !process.env.clientSecret) {


// This captures and evaluates any message sent to the bot as a DM // This captures and evaluates any message sent to the bot as a DM
// or sent to the bot in the form "@bot message" and passes it to // or sent to the bot in the form "@bot message" and passes it to
// Botkit Studio to evaluate for trigger words and patterns. // Botkit CMS to evaluate for trigger words and patterns.
// If a trigger is matched, the conversation will automatically fire! // If a trigger is matched, the conversation will automatically fire!
// You can tie into the execution of the script using the functions // You can tie into the execution of the script using the functions
// controller.studio.before, controller.studio.after and controller.studio.validate // controller.studio.before, controller.studio.after and controller.studio.validate
Expand All @@ -144,7 +139,7 @@ if (!process.env.clientId || !process.env.clientSecret) {
if (!convo) { if (!convo) {
// no trigger was matched // no trigger was matched
// If you want your bot to respond to every message, // If you want your bot to respond to every message,
// define a 'fallback' script in Botkit Studio // define a 'fallback' script in Botkit CMS
// and uncomment the line below. // and uncomment the line below.
// controller.studio.run(bot, 'fallback', message.user, message.channel); // controller.studio.run(bot, 'fallback', message.user, message.channel);
} else { } else {
Expand All @@ -153,14 +148,14 @@ if (!process.env.clientId || !process.env.clientSecret) {
convo.setVar('current_time', new Date()); convo.setVar('current_time', new Date());
} }
}).catch(function(err) { }).catch(function(err) {
bot.reply(message, 'I experienced an error with a request to Botkit Studio: ' + err); bot.reply(message, 'I experienced an error with a request to Botkit CMS: ' + err);
debug('Botkit Studio: ', err); debug('Botkit CMS: ', err);
}); });
}); });
} else { } else {
console.log('~~~~~~~~~~'); console.log('~~~~~~~~~~');
console.log('NOTE: Botkit Studio functionality has not been enabled'); console.log('NOTE: Botkit CMS functionality has not been enabled');
console.log('To enable, pass in a studio_token parameter with a token from https://studio.botkit.ai/'); console.log('Learn mode https://github.com/howdyai/botkit-cms');
} }
} }


Expand All @@ -172,8 +167,7 @@ function usage_tip() {
console.log('~~~~~~~~~~'); console.log('~~~~~~~~~~');
console.log('Botkit Starter Kit'); console.log('Botkit Starter Kit');
console.log('Execute your bot application like this:'); console.log('Execute your bot application like this:');
console.log('clientId=<MY SLACK CLIENT ID> clientSecret=<MY CLIENT SECRET> PORT=3000 studio_token=<MY BOTKIT STUDIO TOKEN> node bot.js'); console.log('clientId=<MY SLACK CLIENT ID> clientSecret=<MY CLIENT SECRET> PORT=3000 node bot.js');
console.log('Get Slack app credentials here: https://api.slack.com/apps') console.log('Get Slack app credentials here: https://api.slack.com/apps')
console.log('Get a Botkit Studio token here: https://studio.botkit.ai/')
console.log('~~~~~~~~~~'); console.log('~~~~~~~~~~');
} }
58 changes: 0 additions & 58 deletions components/express_middleware/register_with_studio.js

This file was deleted.

6 changes: 0 additions & 6 deletions components/express_webserver.js
Expand Up @@ -27,12 +27,6 @@ module.exports = function(controller) {
webserver.set('view engine', 'hbs'); webserver.set('view engine', 'hbs');
webserver.set('views', __dirname + '/../views/'); webserver.set('views', __dirname + '/../views/');


// import express middlewares that are present in /components/express_middleware
var normalizedPath = require("path").join(__dirname, "express_middleware");
require("fs").readdirSync(normalizedPath).forEach(function(file) {
require("./express_middleware/" + file)(webserver, controller);
});

webserver.use(express.static('public')); webserver.use(express.static('public'));


var server = http.createServer(webserver); var server = http.createServer(webserver);
Expand Down
30 changes: 8 additions & 22 deletions components/onboarding.js
Expand Up @@ -3,29 +3,15 @@ var debug = require('debug')('botkit:onboarding');
module.exports = function(controller) { module.exports = function(controller) {


controller.on('onboard', function(bot) { controller.on('onboard', function(bot) {

debug('Starting an onboarding experience!'); debug('Starting an onboarding experience!');

bot.startPrivateConversation({user: bot.config.createdBy},function(err,convo) {
if (controller.config.studio_token) { if (err) {
bot.api.im.open({user: bot.config.createdBy}, function(err, direct_message) { console.log(err);
if (err) { } else {
debug('Error sending onboarding message:', err); convo.say('I am a bot that has just joined your team');
} else { convo.say('You must now /invite me to a channel so that I can be of use!');
controller.studio.run(bot, 'onboarding', bot.config.createdBy, direct_message.channel.id, direct_message).catch(function(err) { }
debug('Error: encountered an error loading onboarding script from Botkit Studio:', err); });
});
}
});
} else {
bot.startPrivateConversation({user: bot.config.createdBy},function(err,convo) {
if (err) {
console.log(err);
} else {
convo.say('I am a bot that has just joined your team');
convo.say('You must now /invite me to a channel so that I can be of use!');
}
});
}
}); });


} }
5 changes: 0 additions & 5 deletions components/plugin_glitch.js
Expand Up @@ -17,13 +17,8 @@ module.exports = function(controller) {


// if this is running on Glitch // if this is running on Glitch
if (process.env.PROJECT_DOMAIN) { if (process.env.PROJECT_DOMAIN) {

// Register with studio using the provided domain name
controller.registerDeployWithStudio(process.env.PROJECT_DOMAIN + '.glitch.me');

// make a web call to self every 55 seconds // make a web call to self every 55 seconds
// in order to avoid the process being put to sleep. // in order to avoid the process being put to sleep.
keepalive(); keepalive();

} }
} }
17 changes: 3 additions & 14 deletions docs/glitch_directory.md
@@ -1,6 +1,6 @@
# Botkit Starter Kit for Slack Bots # Botkit Starter Kit for Slack Bots


This repo contains everything you need to get started building a Slack bot with [Botkit](https://botkit.ai) and [Botkit Studio](https://botkit.ai). This repo contains everything you need to get started building a Slack bot with [Botkit](https://botkit.ai).


Botkit is designed to ease the process of designing and running useful, creative bots that live inside messaging platforms. Bots are applications that can send and receive messages, and in many cases, appear alongside their human counterparts as users. Botkit is designed to ease the process of designing and running useful, creative bots that live inside messaging platforms. Bots are applications that can send and receive messages, and in many cases, appear alongside their human counterparts as users.


Expand All @@ -12,43 +12,32 @@ If you are looking to create a bot on other platforms using Glitch, check out th


### What's Included ### What's Included
* [Botkit core](https://github.com/howdyai/botkit/blob/master/docs/readme.md#developing-with-botkit) - a complete programming system for building conversational software * [Botkit core](https://github.com/howdyai/botkit/blob/master/docs/readme.md#developing-with-botkit) - a complete programming system for building conversational software
* [Botkit Studio API](https://github.com/howdyai/botkit/blob/master/docs/readme-studio.md#function-index) - additional APIs that extend Botkit with powerful tools and APIs
* [Pre-configured Express.js webserver](https://expressjs.com/) including: * [Pre-configured Express.js webserver](https://expressjs.com/) including:
* A customizable "Install my Bot" homepage * A customizable "Install my Bot" homepage
* Login and oauth endpoints that allow teams to install your bot * Login and oauth endpoints that allow teams to install your bot
* Webhook endpoints for communicating with platforms * Webhook endpoints for communicating with platforms
* Sample skill modules that demonstrate various features of Botkit * Sample skill modules that demonstrate various features of Botkit
* A customizable onboarding experience for new teams powered by Botkit Studio


### Getting Started ### Getting Started


There are a myriad of methods you can use to set up an application on Slack, but we feel this is the most flexible path you can use to setup your bot on the Slack Events API. There are a myriad of methods you can use to set up an application on Slack, but we feel this is the most flexible path you can use to setup your bot on the Slack Events API.


#### Use Botkit Studio
[Botkit Studio](https://studio.botkit.ai/signup?code=slackglitch) is a set of tools that adds capabilities to the open source Botkit library by offering hosted GUI interfaces for script management and action trigger definition.

While Botkit Studio is *not required* to build a bot using Botkit, we highly recommend it as your bot will be easier to manage, customize and extend.

#### Set up your Slack Application #### Set up your Slack Application


Once you have remixed this project, the next thing you will want to do is set up a new Slack application via the [Slack developer portal](https://api.slack.com/). This is a multi-step process, but only takes a few minutes. Once you have remixed this project, the next thing you will want to do is set up a new Slack application via the [Slack developer portal](https://api.slack.com/). This is a multi-step process, but only takes a few minutes.


* [Read this step-by-step guide](https://github.com/howdyai/botkit/blob/master/docs/slack-events-api.md) to make sure everything is set up. * [Read this step-by-step guide](https://github.com/howdyai/botkit/blob/master/docs/slack-events-api.md) to make sure everything is set up.
* We also have this [handy video walkthrough](https://youtu.be/us2zdf0vRz0) for setting up this project with Glitch. * We also have this [handy video walkthrough](https://youtu.be/us2zdf0vRz0) for setting up this project with Glitch.


Next, get a Botkit Studio token [from your Botkit developer account](https://studio.botkit.ai/) if you have decided to use Studio. Update the `.env` file in the Glitch project with your newly acquired tokens.

Update the `.env` file in the Glitch project with your newly acquired tokens. If you have created this project from Studio, all your tokens have been entered in your `.env` already for you!


Once all your tokens have been entered, your `Show Live` button should become green. Click this button and you will see an option to add this bot to your team. Once all your tokens have been entered, your `Show Live` button should become green. Click this button and you will see an option to add this bot to your team.


Once successfully logged in, your bot will connect to Slack AND Botkit Studio and leap into action!

Now comes the fun part of [making your bot!](https://github.com/howdyai/botkit/blob/master/docs/readme.md#basic-usage) Now comes the fun part of [making your bot!](https://github.com/howdyai/botkit/blob/master/docs/readme.md#basic-usage)


# Developer & Support Community # Developer & Support Community


You can find full documentation for Botkit on our [GitHub page](https://github.com/howdyai/botkit/blob/master/readme.md). Botkit Studio users can access the [Botkit Studio Knowledge Base](https://botkit.groovehq.com/help_center) for help in managing their account. You can find full documentation for Botkit on our [GitHub page](https://github.com/howdyai/botkit/blob/master/readme.md).


### Need more help? ### Need more help?
* Glitch allows users to ask the community for help directly from the editor! For more information on raising your hand, [read this blog post.](https://medium.com/glitch/just-raise-your-hand-how-glitch-helps-aa6564cb1685) * Glitch allows users to ask the community for help directly from the editor! For more information on raising your hand, [read this blog post.](https://medium.com/glitch/just-raise-your-hand-how-glitch-helps-aa6564cb1685)
Expand Down
8 changes: 3 additions & 5 deletions glitch_readme.md
@@ -1,12 +1,10 @@
# Howdy, bot builder! # Howdy, bot builder!
## When you see "Show Live" in the upper left corner, your new bot app is live. ## When you see "Show Live" in the upper left corner, your new bot app is live.
## Click the sunglasses to view your app, then go back to [Botkit Studio](https://studio.botkit.ai) to finish up. ## Click the sunglasses to view your app!


### Having trouble? ### Having trouble?
* You should check [that your .env file](?path=.env:1:0) has all the correct tokens as created in your [provisioning step](https://github.com/howdyai/botkit/blob/master/docs/provisioning/). * You should check [that your .env file](?path=.env:1:0) has all the correct tokens.

* The [Botkit Studio knowledge base](https://botkit.groovehq.com/) contains in-depth information about using Botkit Studio, or you can [contact us](https://botkit.groovehq.com/knowledge_base/topics/contact-us-23) directly.


* *Raise your hand!* - Glitch allows users to ask the community for help directly from the editor! For more information on raising your hand, [read this blog post.](https://medium.com/glitch/just-raise-your-hand-how-glitch-helps-aa6564cb1685) * *Raise your hand!* - Glitch allows users to ask the community for help directly from the editor! For more information on raising your hand, [read this blog post.](https://medium.com/glitch/just-raise-your-hand-how-glitch-helps-aa6564cb1685)


* Join our thriving community of Botkit developers and bot enthusiasts at large. Over 4500 members strong, [our open teams group](http://community.botkit.ai) is _the place_ for people interested in the art and science of making bots. * Join our thriving community of Botkit developers and bot enthusiasts at large. Over 9000 members strong, [our open community group](http://community.botkit.ai) is _the place_ for people interested in the art and science of making bots.

0 comments on commit 9497da3

Please sign in to comment.