Code Monkey home page Code Monkey logo

hubot-messenger-bot's Introduction

ClaudeBot

Build Status Dependency Status

A general-purpose IRC bot powered by Github's Hubot.

We are in the midst of revising our documentation for ClaudeBot to reflect changes in Hubot, community scripts, and our personal scripts. Suggestions and contributions are welcomed.

About

Hubot is Github's extendable and scriptable chat bot.

ClaudeBot is a personalised instance of Hubot, and it currently reside in the FyreChat IRC network. It is configured to be deployed on Heroku, but efforts are being made to migrate it to a self-managed platform.

It leverages on Hubot's core scripts, and tries to maintain consistency with its standards / conventions. In practice, this philosophy may be omitted if an alternative or a need for immediate action is required. Simply put, we may deviate from Hubot's codebase, and community if we have to.

It is designed to bring the power of numerous web APIs onto a single chat interface.

Running

If you are just getting started with node.js, npm and Hubot, please check out Hubot's documentation. This documentation assumes you have reasonable experience with the aforementioned technologies.

Locally (Shell)

Fork and/or download this repository. Now, execute in the project directory:

% bin/hubot

Deployment

Refer to Hubot's bin/hubot file for a list of available flags. Change Procfile accordingly if you are deploying it on Heroku. Hubot's official documentation provides more thorough information on deployment.

If you would like to change the bot's name (currently set to ClaudeBot), modify ClaudeBot's bin/hubot (the bot's alias is defined in this file as well). This is not the same as Hubot's bin/hubot (which is a dependency of ClaudeBot).

Persistence

ClaudeBot's brain data (in-memory key-value store) is frequently synchronised to and from a Redis store (RedisLabs). Scripts may use robot.brain to store and retrieve long-term data (e.g. user information).

It previously relied on Dweet.io for persistence, but it has since been deprecated as it is not practical in the long-run.

Environment Variables

The following environment variables (the bot's configuration) are required for certain aspects of the bot to work:

IRC Adapter

  • HUBOT_IRC_SERVER
  • HUBOT_IRC_ROOMS (comma-separated)
  • HUBOT_IRC_NICK

View hubot-irc documentation for more information. You may also decide to change the bot's adapter. Alter the -a or --adapter flag (see Procfile for an example on how it is used).

Services

  • REDIS_URL
  • GOOGLE_API_KEY
  • PASTEBIN_API_KEY
  • STEAM_API_KEY
  • TWITCH_API_KEY

Ensure they are set to avoid any unexpected behaviour or errors. Alternatively, you may disable the scripts that require them (e.g. hubot-steam-webapi uses the STEAM_API_KEY).

Scripts

ClaudeBot neither relies on nor supports the old hubot-scripts repository. Scripts may be added via npm and external-scripts.json, or through the scripts/ directory (search npm or visit the organisation for a list of available scripts). We strongly discourage the use of hubot-scripts.

Commands

Refer to the installed / external scripts' documentation (i.e. their README) or visit the online help page for ClaudeBot.

Assuming your copy of the bot is online, its own help page is located at localhost:8080/BotName/help by default. The default web port is 5000 if it is executed using foreman, i.e. Procfile. Also, typing ! help (on your bot's adapter interface, e.g. Shell, IRC, Slack, etc) will return a list of available commands. ! is an alias for ClaudeBot, and may be used interchangeably.

Community

We love developing scripts, and improvements for Hubot. It is also a good learning experience and we welcome you to join us!

We are available to help you at FyreChat's #sandbox channel. Feel free to open up issues or pull requests. Comments, feature requests, bug reports, questions, etc will be entertained.

hubot-messenger-bot's People

Contributors

mrsaints avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hubot-messenger-bot's Issues

Error receiving messages

Hi,

I'm receveing an error when the webhook is called. Did you know what it could be ?

017-08-23T18:34:09.426606+00:00 app[web.1]: [Wed Aug 23 2017 18:34:09 GMT+0000 (UTC)] INFO /app/scripts/social.coffee is using deprecated documentation syntax
2017-08-23T18:34:09.600829+00:00 app[web.1]: [Wed Aug 23 2017 18:34:09 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379
2017-08-23T18:34:09.379841+00:00 app[web.1]: [Wed Aug 23 2017 18:34:09 GMT+0000 (UTC)] INFO hubot-messenger-bot: Adapter loaded.
2017-08-23T18:34:09.383405+00:00 app[web.1]: [Wed Aug 23 2017 18:34:09 GMT+0000 (UTC)] INFO hubot-messenger-bot: Adapter running.
2017-08-23T18:34:10.058992+00:00 heroku[web.1]: State changed from starting to up
2017-08-23T18:39:09.262913+00:00 heroku[router]: at=info method=POST path="/webhook/" host=facebook-botchat.herokuapp.com request_id=4a92dfbc-500e-4558-b6b1-6db016227335 fwd="66.220.156.180" dyno=web.1 connect=0ms service=33ms status=500 bytes=242 protocol=https
2017-08-23T18:39:09.267999+00:00 app[web.1]: TypeError: Cannot read property 'length' of undefined
2017-08-23T18:39:09.268016+00:00 app[web.1]: at /app/node_modules/hubot-messenger-bot/src/messenger.coffee:77:13
2017-08-23T18:39:09.268022+00:00 app[web.1]: at callbacks (/app/node_modules/hubot/node_modules/express/lib/router/index.js:164:37)
2017-08-23T18:39:09.268023+00:00 app[web.1]: at param (/app/node_modules/hubot/node_modules/express/lib/router/index.js:138:11)
2017-08-23T18:39:09.268024+00:00 app[web.1]: at pass (/app/node_modules/hubot/node_modules/express/lib/router/index.js:145:5)
2017-08-23T18:39:09.268025+00:00 app[web.1]: at Router._dispatch (/app/node_modules/hubot/node_modules/express/lib/router/index.js:173:5)
2017-08-23T18:39:09.268025+00:00 app[web.1]: at Object.router (/app/node_modules/hubot/node_modules/express/lib/router/index.js:33:10)
2017-08-23T18:39:09.268026+00:00 app[web.1]: at next (/app/node_modules/hubot/node_modules/express/node_modules/connect/lib/proto.js:174:15)
2017-08-23T18:39:09.268027+00:00 app[web.1]: at Object.multipart [as handle] (/app/node_modules/hubot/node_modules/connect-multiparty/index.js:42:27)
2017-08-23T18:39:09.268027+00:00 app[web.1]: at next (/app/node_modules/hubot/node_modules/express/node_modules/connect/lib/proto.js:174:15)
2017-08-23T18:39:09.268029+00:00 app[web.1]: at Object.urlencodedParser [as handle] (/app/node_modules/hubot/node_modules/express/node_modules/connect/node_modules/body-parser/lib/types/urlencoded.js:81:44)
2017-08-23T18:39:09.268030+00:00 app[web.1]: at next (/app/node_modules/hubot/node_modules/express/node_modules/connect/lib/proto.js:174:15)
2017-08-23T18:39:09.268031+00:00 app[web.1]: at /app/node_modules/hubot/node_modules/express/node_modules/connect/node_modules/body-parser/lib/read.js:121:5
2017-08-23T18:39:09.268032+00:00 app[web.1]: at invokeCallback (/app/node_modules/hubot/node_modules/express/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:262:16)
2017-08-23T18:39:09.268034+00:00 app[web.1]: at done (/app/node_modules/hubot/node_modules/express/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:251:7)
2017-08-23T18:39:09.268035+00:00 app[web.1]: at IncomingMessage.onEnd (/app/node_modules/hubot/node_modules/express/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:307:7)
2017-08-23T18:39:09.268036+00:00 app[web.1]: at IncomingMessage.emit (events.js:92:17)
2017-08-23T18:39:09.268036+00:00 app[web.1]: at _stream_readable.js:944:16
2017-08-23T18:39:09.268037+00:00 app[web.1]: at process._tickCallback (node.js:458:13)

How to get a webhook verified?

When I run the bot with the adapter i get the error:
Error: You must configure the MESSENGER_VERIFY_TOKEN environment variable.
But i need a running bot in order for fb to verify my webhook.

How do i solve this dependency?

Can't start with heroku - Syntax Error

Was trying to create a messenger bot using this repo. Turns out there is a syntax error. Here is the log dump.

Starting process with command bin/hubot -a messenger
2016-07-01T12:04:13.437115+00:00 app[web.1]: ["p_" + userID]: 0
2016-07-01T12:04:13.437129+00:00 app[web.1]: ^
2016-07-01T12:04:13.436621+00:00 app[web.1]: /app/node_modules/hubot-messenger/node_modules/facebook-chat-api/utils.js:194
2016-07-01T12:04:13.436471+00:00 app[web.1]:
2016-07-01T12:04:13.452413+00:00 app[web.1]: [Fri Jul 01 2016 12:04:13 GMT+0000 (UTC)] ERROR Cannot load adapter messenger - SyntaxError: Unexpected token [
2016-07-01T12:04:15.026418+00:00 heroku[web.1]: Process exited with status 1
2016-07-01T12:04:15.042172+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-01T12:04:15.043279+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-01T12:04:17.184920+00:00 heroku[web.1]: Starting process with command bin/hubot -a messenger
2016-07-01T12:04:25.174512+00:00 app[web.1]: ^
2016-07-01T12:04:25.171691+00:00 app[web.1]: /app/node_modules/hubot-messenger/node_modules/facebook-chat-api/utils.js:194
2016-07-01T12:04:25.174499+00:00 app[web.1]: ["p_" + userID]: 0
2016-07-01T12:04:25.171515+00:00 app[web.1]:
2016-07-01T12:04:25.180347+00:00 app[web.1]: [Fri Jul 01 2016 12:04:25 GMT+0000 (UTC)] ERROR Cannot load adapter messenger - SyntaxError: Unexpected token [
2016-07-01T12:04:26.343555+00:00 heroku[web.1]: Process exited with status 1
2016-07-01T12:04:26.379282+00:00 heroku[web.1]: State changed from starting to crashed

404 on webhook URL?

I've tried with ngrok as you suggested in the readme but I get a 404.

ngrok by @inconshreveable (Ctrl+C to quit)

Tunnel Status online
Version 2.0.25/2.0.25
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://1d35d110.ngrok.io -> localhost:8080
Forwarding https://1d35d110.ngrok.io -> localhost:8080

Connections ttl opn rt1 rt5 p50 p90
2 0 0.00 0.00 0.09 0.10

HTTP Requests

GET /webhook 404 Not Found
GET /webhook 404 Not Found

hubot is running with your adapter, there are no errors on startup. What could I be missing?

my-bot# ./bin/hubot -a messenger-bot
[Thu Apr 14 2016 17:44:55 GMT+0300 (MSK)] INFO hubot-messenger-bot: Adapter loaded.
[Thu Apr 14 2016 17:44:55 GMT+0300 (MSK)] INFO hubot-messenger-bot: Adapter running.
[Thu Apr 14 2016 17:44:56 GMT+0300 (MSK)] INFO Data for hubot brain retrieved from Redis

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.