Giter Site home page Giter Site logo

How to deploy on Heroku? about botkit HOT 6 CLOSED

mdesanti avatar mdesanti commented on July 30, 2024
How to deploy on Heroku?

from botkit.

Comments (6)

coreysyms avatar coreysyms commented on July 30, 2024 5

Couple things.

  1. You have to have a Procfile in the root of your git repository targeting worker: node slack_bot.js or whatever the path / name is to your start file is (the default is slack_bot.js). Commit to your repository.
  2. Go to your Heroku dashboard and under settings click "revel config vars" and add in a new key:value with the key being "token" and the value being the slack key your were given by slack.
  3. Go to the resources tab, you should now see your "worker dyno". click the pencil, and slide it to the "on" state. You should see your bot wake up in slack, (if you navigate to a different tab, and then back to the resources tab you will see status "awake").
  4. if you are using the "uptime" example command from the example in botkit, you can type "uptime" and you should see something like :bot_face: I am a bot named whatever. I have been running for 2.2119333333333335 minutes on a bunch of letters and numbers. This means your bot is awake and running

from botkit.

cssidy avatar cssidy commented on July 30, 2024 2

This works! I forgot to add a Procfile which Heroku needs to start up the dyno (free plan) after periods of inactivity. There is just one line of code worker: node bot.js in that Procfile, but it makes all the difference.

from botkit.

c4tch avatar c4tch commented on July 30, 2024

Hi, I'm having similar problems, when I run a simple botkit app on Heroku, I get after 60 seconds "Stopping all processes with SIGTERM" and the app shuts down. Now I know that a node.js server needs a port, and heroku spins them up dynamically, but do you know what I should change to do this?
My script is tiny:

"use strict";

const SLACK_BOT_TOKEN = process.env.SLACK_BOT_TOKEN;

let Botkit = require('botkit'),
    formatter = require('./modules/slack-formatter'),
    salesforce = require('./modules/salesforce'), 

    controller = Botkit.slackbot(),

    bot = controller.spawn({
        token: SLACK_BOT_TOKEN
    });

bot.startRTM(err => {
    if (err) {
        throw new Error('Could not connect to Slack');
    }
});

controller.hears(['help'], 'direct_message,direct_mention,mention', (bot, message) => {
    bot.reply(message, {
        text: `You can ask me things like:
    "Search account Acme" or "Search Acme in acccounts"
    "Search contact Lisa Smith" or "Search Lisa Smith in contacts"
    "Search opportunity Big Deal"
    "Create contact"
    "Create case"`
    });
});

from botkit.

c4tch avatar c4tch commented on July 30, 2024

Thanks! It worked really well, though the reddis bit needed some tweaking.
There was a good blog on it with sample code. It's up and running nicely!

On 12 May 2016 at 20:48, Corey Snyder [email protected] wrote:

Couple things.

You have to have a Procfile in the root of your git repository
targeting worker: node slack_bot.js or whatever the path / name is to
your start file is (the default is slack_bot.js). Commit to your repository.
2.

Go to your Heroku dashboard and under settings click "revel config
vars" and add in a new key:value with the key being "token" and the value
being the slack key your were given by slack.
3.

Go to the resources tab, you should now see your "worker dyno". click
the pencil, and slide it to the "on" state. You should see your bot wake up
in slack, (if you navigate to a different tab, and then back to the
resources tab you will see status "awake").
4.

if you are using the "uptime" example command from the example in
botkit, you can type "uptime" and you should see something like :bot_face:
I am a bot named whatever. I have been running for 2.2119333333333335
minutes on a bunch of letters and numbers. This means your bot is
awake and running


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#53 (comment)

from botkit.

coreysyms avatar coreysyms commented on July 30, 2024

Great! A tip, I turn off the bot in Heroku by sliding the worker dyno to "off" if you need the bot to go offline to work locally via the terminal or whatever. Also, Heroku will "restart" if you push to production some new code. Finally, the bot will have to "sleep" if you are using the free Heroku account for a few hours in each 24 hour cycle. So upgrade to the hobby account if you need your bot "awake" 24-7.

from botkit.

Daij-Djan avatar Daij-Djan commented on July 30, 2024

see https://github.com/Daij-Djan/chatbot_templates for a checklist to deploy to heroku ;)

from botkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.