Skip to content
Permalink
Browse files

remove studio features

  • Loading branch information...
benbrown committed Dec 20, 2018
1 parent fdb4c6b commit 9497da3b22f7e3bd6dde0fc7e708c9a077ccb605
@@ -3,7 +3,7 @@
"description": "A starting point for building custom Slack applications",
"repository": "https://github.com/howdyai/botkit-starter-slack",
"keywords": ["node", "bots", "slack","botkit"],
"website": "https://studio.botkit.ai/",
"website": "https://botkit.ai/",
"success_url":"/",
"addons":[
{
@@ -17,10 +17,6 @@
},
"clientSecret": {
"description": "Client Secret provided by Slack"
},
"studio_token": {
"description": "Token associated with your bot in Botkit Studio",
"required":false
}
}
}
24 bot.js
@@ -23,13 +23,9 @@ This bot demonstrates many of the core features of Botkit:
-> http://api.slack.com
Get a Botkit Studio token from Botkit.ai:
-> https://studio.botkit.ai/
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:
@@ -97,15 +93,14 @@ if (!process.env.clientId || !process.env.clientSecret) {

webserver.get('/', function(req, res){
res.render('installation', {
studio_enabled: controller.config.studio_token ? true : false,
domain: req.get('host'),
protocol: req.protocol,
glitch_domain: process.env.PROJECT_DOMAIN,
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);
}else {

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

// 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
// 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!
// You can tie into the execution of the script using the functions
// controller.studio.before, controller.studio.after and controller.studio.validate
@@ -144,7 +139,7 @@ if (!process.env.clientId || !process.env.clientSecret) {
if (!convo) {
// no trigger was matched
// 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.
// controller.studio.run(bot, 'fallback', message.user, message.channel);
} else {
@@ -153,14 +148,14 @@ if (!process.env.clientId || !process.env.clientSecret) {
convo.setVar('current_time', new Date());
}
}).catch(function(err) {
bot.reply(message, 'I experienced an error with a request to Botkit Studio: ' + err);
debug('Botkit Studio: ', err);
bot.reply(message, 'I experienced an error with a request to Botkit CMS: ' + err);
debug('Botkit CMS: ', err);
});
});
} else {
console.log('~~~~~~~~~~');
console.log('NOTE: Botkit Studio 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('NOTE: Botkit CMS functionality has not been enabled');
console.log('Learn mode https://github.com/howdyai/botkit-cms');
}
}

@@ -172,8 +167,7 @@ function usage_tip() {
console.log('~~~~~~~~~~');
console.log('Botkit Starter Kit');
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 a Botkit Studio token here: https://studio.botkit.ai/')
console.log('~~~~~~~~~~');
}

This file was deleted.

@@ -27,12 +27,6 @@ module.exports = function(controller) {
webserver.set('view engine', 'hbs');
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'));

var server = http.createServer(webserver);
@@ -3,29 +3,15 @@ var debug = require('debug')('botkit:onboarding');
module.exports = function(controller) {

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

debug('Starting an onboarding experience!');

if (controller.config.studio_token) {
bot.api.im.open({user: bot.config.createdBy}, function(err, direct_message) {
if (err) {
debug('Error sending onboarding message:', err);
} else {
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!');
}
});
}
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!');
}
});
});

}
@@ -17,13 +17,8 @@ module.exports = function(controller) {

// if this is running on Glitch
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
// in order to avoid the process being put to sleep.
keepalive();

}
}
@@ -1,6 +1,6 @@
# 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.

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

### 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 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:
* A customizable "Install my Bot" homepage
* Login and oauth endpoints that allow teams to install your bot
* Webhook endpoints for communicating with platforms
* Sample skill modules that demonstrate various features of Botkit
* A customizable onboarding experience for new teams powered by Botkit Studio

### 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.

#### 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

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.
* 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. If you have created this project from Studio, all your tokens have been entered in your `.env` already for you!
Update the `.env` file in the Glitch project with your newly acquired tokens.

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)

# 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?
* 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)
@@ -1,12 +1,10 @@
# Howdy, bot builder!
## 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?
* 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/).

* 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.
* You should check [that your .env file](?path=.env:1:0) has all the correct tokens.

* *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.
You can’t perform that action at this time.