GithubHelp home page GithubHelp logo

rocketchat / hubot-natural Goto Github PK

View Code? Open in Web Editor NEW
145.0 21.0 44.0 481 KB

Natural Language Processing Chatbot for RocketChat

Home Page: https://open.rocket.chat/channel/hubot-natural

License: MIT License

CoffeeScript 84.28% Python 15.72%
hubot chatbot rocketchat rocketchat-hubot nlp nodejs coffeescript hubot-natural

hubot-natural's Introduction

Hubot Natural

Build Status

Natural Language ChatBot

Hubot is one of the most famous bot creating framework on the web, that's because github made it easy to create. If you can define your commands in a RegExp param, basically you can do anything with Hubot. That's a great contribution to ChatOps culture.

Inspired by that, we wanted to provide the same simplicity to our community to develop chatbots that can actually process natural language and execute tasks, as easy as building RegExp oriented bots.

So, we've found a really charming project to initiate from, the Digital Ocean's Heartbot a shot of love to for your favorite chat client =)

Based on Heartbot, we introduced some NLP power from NaturalNode team, an impressive collections of Natural Language Processing libs made to be used in NodeJS.

And so, the magic happens...

Welcome to HubotNatural, a new an exciting chatbot framework based in Hubot and NaturalNode libs, with an simple and extensible architecture designed by Digital Ocean's HeartBot Team, made with love and care by Rocket.Chat Team.

We hope you enjoy the project and find some time to contribute.

How it Works

HubotNatural is made to be easy to train and extend. So what you have to understand basically is that it has an YAML corpus, where you can design your chatbot interactions using nothing but YAML's notation.

All YAML interactions designed in corpus can have it's own parameters, which will be processed by an event class.

Event classes give the possibility to extend HubotNatural. By writing your own event classes you can give your chatbot the skills to interact with any services you need.

YAML corpus

The YAML file is loaded in scripts/index.js, parsed and passed to chatbot bind, which will be found in scripts/bot/index.js, the cortex of the bot, where all information flux and control are programmed.

The YAML corpus is located in training_data/corpus.yml and it's basic structure looks like this:

trust: .85
interactions:
  - name: salutation
    expect:
      - hi there
      - hello everyone
      - what's up bot
      - good morning
    answer:
      - - Hello there $user, how are you?
        - Glad to be here...
      - Hey there, nice to see you!
    event: respond

What this syntax means:

  • trust: the minimum level of certain that must be returned by the classifier in order to run this interaction. Value is 0 to 1 (0% to 100%). If a classifier returns a value of certainty minor than trust, the bots responds with and error interaction node.
  • interactions: An vector with lots of interaction nodes that will be parsed. Every interaction designed to your chatbot must be under an interaction.node object structure.
  • name: that's the unique name of the interaction by which it will be identified. Do not create more than one interaction with the same node.name attribute.
  • expect: Those are the sentences that will be given to the bots training. They can be strings or keywords vectors, like ['consume','use'].
  • answer: the messages that will be sent to the user, if the classifiers get classified above the trust level. The node.message will be parsed and sent by event class. In order to use multiline strings inside your YAML, you must follow the YAML Multiline Strings syntax. You can specify variables in message. By default HubotNatural comes with $user, $bot and $room variables.
  • event: is the name of the CoffeeScript or JavaScript Class inside scripts/events, without the file extension.

Event Coffee Classes

Event classes can be written to extend the chatbot skills. They receives the interaction object and parse the message, like this:

class respond
  constructor: (@interaction) ->
  process: (msg) =>
    sendMessages(stringElseRandomKey(@interaction.answer), msg)

module.exports = respond

It's base constructor is the @interaction node so you can have access to all attributes inside an interaction just using @interaction.attribute. Here you can parse texts, call APIs, read files, access databases, and everything else you need.
You may want to use the function stringElseRandomKey to get a random element of a list, if it's parameter is a list, and use the function sendMessages to send messages to an user.

Logistic Regression Classifier

The NaturalNode library comes with two kinds of classifiers, the Naive Bayes classifier known as the BayesClassifier and the LogisticRegressionClassifier functions. By default, HubotNatural uses the LogisticRegressionClassifier. It just came with better results in our tests.

PorterStemmer

There is also more than one kind of stemmer. You should set the stemmer to define your language. By default we use the PorterStemmerPt for portuguese, but you can find english, russian, italian, french, spanish and other stemmers in NaturalNode libs, or even write your own based on those.

Just check inside node_modules/natural/lib/natural/stemmers/.

To change the stemmers language, just set the environment variable HUBOT_LANG as pt, en, es, and any other language termination that corresponds to a stemmer file inside the above directory.

Deploy with Docker

We have a Dockerfile that builds a lightweight image based in Linux Alpine with all the repository content so you can upload that image to a docker registry and deploy your chatbot from there. It is located on docker folder.

You also can use docker-compose.yml file to load a local instance of Rocket.Chat, MongoDB and HubotNatural services, where you can change the parameters if you must.

The docker-compose file looks like this:

version: '2'

services:
  rocketchat:
    image: rocketchat/rocket.chat:latest
    restart: unless-stopped
    volumes:
      - ./uploads:/app/uploads
    environment:
      - PORT=3000
      - ROOT_URL=http://localhost:3000
      - MONGO_URL=mongodb://mongo:27017/rocketchat
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local
      - MAIL_URL=smtp://smtp.email
#       - HTTP_PROXY=http://proxy.domain.com
#       - HTTPS_PROXY=http://proxy.domain.com
    depends_on:
      - mongo
    ports:
      - 3000:3000

  mongo:
    image: mongo:3.2
    restart: unless-stopped
    volumes:
     - ./data/db:/data/db
     #- ./data/dump:/dump
    command: mongod --smallfiles --oplogSize 128 --replSet rs0

  mongo-init-replica:
    image: mongo:3.2
    command: 'mongo mongo/rocketchat --eval "rs.initiate({ _id: ''rs0'', members: [ { _id: 0, host: ''localhost:27017'' } ]})"'
    depends_on:
      - mongo

  hubot-natural:
    build: .
    restart: unless-stopped
    environment:
      - HUBOT_ADAPTER=rocketchat
      - HUBOT_NAME='Hubot Natural'
      - HUBOT_OWNER=RocketChat
      - HUBOT_DESCRIPTION='Hubot natural language processing'
      - HUBOT_LOG_LEVEL=debug
      - HUBOT_CORPUS=corpus.yml
      - HUBOT_LANG=pt
      - RESPOND_TO_DM=true
      - RESPOND_TO_LIVECHAT=true
      - RESPOND_TO_EDITED=true
      - LISTEN_ON_ALL_PUBLIC=false
      - ROCKETCHAT_AUTH=password
      - ROCKETCHAT_URL=rocketchat:3000
      - ROCKETCHAT_ROOM=GENERAL
      - ROCKETCHAT_USER=botnat
      - ROCKETCHAT_PASSWORD=botnatpass
      - HUBOT_NATURAL_DEBUG_MODE=true
    volumes:
      - ./scripts:/home/hubotnat/bot/scripts
      - ./training_data:/home/hubotnat/bot/training_data
    depends_on:
      - rocketchat
    ports:
      - 3001:8080

You can change the attributes of variables and volumes to your specific needs and run docker-compose up in terminal to start the rocketchat service at http://localhost:3000. ATTENTION: You must remember that hubot must have a real rocketchat user created to login with. So by the first time you run this, you must first go into rocketchat and create a new user for hubot, change the ROCKETCHAT_USER and ROCKETCHAT_PASSWORD variables in the docker-compose.yml file, and then reload the services using docker-compose stop && docker-compose up to start it all over again.

If you want to run only the hubot-natural service to connect an already running instance of Rocket.Chat, you just need to remember to set the ROCKETCHAT_URL to a correct value, like https://open.rocket.chat.

Bot configuration

In order to correctly use Hubot Natural, after running docker-compose up command, it is necessary to do some configuration steps. To do that, there are two main options:

The first one is to do manually the steps described at bot config documentation.

The second option is to execute the script bot_config.py, located at root directory on project. That will automatically configure bot based on following variables defined on script: admin_name, admin_password, bot_name and bot_password. It is important to remember of properly set the values of this variables according to the context. The values used on bot_name and bot_password must be the same defined on docker-compose.yml, on the variables ROCKETCHAT_USER and ROCKETCHAT_PASSWORD respectively. And the values defined at admin_name and admin_password variables must be the credentials of an pre existent user on rocketchat, that has admin permissions.

To create an admin user automatically, before executing the services, just define the variables ADMIN_USERNAME and ADMIN_PASS for rocketchat service on docker-compose.yml.

Deploy with Hubot

To deploy HubotNatural, first you have to install yo hubot-generator:

npm install -g yo generator-hubot

Then you will clone HubotNatural repository:

git clone https://github.com/RocketChat/hubot-natural.git mybot

Change 'mybot' in the git clone command above to whatever your bot's name will be, and install hubot binaries, without overwitting any of the files inside the folder:

cd mybot
npm install
yo hubot

                     _____________________________
                    /                             \
   //\              |      Extracting input for    |
  ////\    _____    |   self-replication process   |
 //////\  /_____\   \                             /
 ======= |[^_/\_]|   /----------------------------
  |   | _|___@@__|__
  +===+/  ///     \_\
   | |_\ /// HUBOT/\\
   |___/\//      /  \\
         \      /   +---+
          \____/    |   |
           | //|    +===+
            \//      |xx|

? Owner Diego <[email protected]>
? Bot name mybot
? Description A simple helpful chatbot for your Company
? Bot adapter rocketchat
   create bin/hubot
   create bin/hubot.cmd
 conflict Procfile
? Overwrite Procfile? do not overwrite
     skip Procfile
 conflict README.md
? Overwrite README.md? do not overwrite
     skip README.md
   create external-scripts.json
   create hubot-scripts.json
 conflict .gitignore
? Overwrite .gitignore? do not overwrite
     skip .gitignore
 conflict package.json
? Overwrite package.json? do not overwrite
     skip package.json
   create scripts/example.coffee
   create .editorconfig

Now, to run your chatbot in shell, you should run:

bin/hubot

wait a minute for the loading process, and then you can talk to mybot.

Take a look to adapters to run your bot in other platafforms.

Configure Live Transfer

It's possible to configure Hubot Natural to redirect conversation to a real person, in moments when the bot can not help users as much as needed. To activate and configure Live Transfer feature, follow the steps described on live transfer config documentation.

Env Variables:

In your terminal window, run:

export HUBOT_ADAPTER=rocketchat
export HUBOT_OWNER=RocketChat
export HUBOT_NAME='Bot Name'
export HUBOT_DESCRIPTION='Description of your bot'
export ROCKETCHAT_URL=https://open.rocket.chat
export ROCKETCHAT_ROOM=GENERAL
export LISTEN_ON_ALL_PUBLIC=false
export RESPOND_TO_DM=true
export RESPOND_TO_LIVECHAT=true
export ROCKETCHAT_USER=catbot
export ROCKETCHAT_PASSWORD='bot password'
export ROCKETCHAT_AUTH=password
export HUBOT_LOG_LEVEL=debug
export HUBOT_CORPUS='corpus.yml'
export HUBOT_LANG='en'
bin/hubot -a rocketchat --name $HUBOT_NAME

You can check hubot-rocketchat adapter project for more details.

PM2 Json File

As NodeJS developers we learned to love Process Manager PM2, and we really encourage you to use it.

npm install pm2 -g

Create a mybot.json file and jut set it's content as:

{
	"apps": [{
		"name": "mybot",
		"interpreter": "/bin/bash",
		"watch": true,
		"ignore_watch" : ["client/img"],
		"script": "bin/hubot",
		"args": "-a rocketchat",
		"port": "3001",
		"env": {
			"ROCKETCHAT_URL": "https://localhost:3000",
			"ROCKETCHAT_ROOM": "general",
			"RESPOND_TO_DM": true,
			"ROCKETCHAT_USER": "mybot",
			"ROCKETCHAT_PASSWORD": "12345",
			"ROCKETCHAT_AUTH": "password",
			"HUBOT_LOG_LEVEL": "debug"
		}
	}
]
}

You can also instantiate more than one process with PM2, if you want for example to run more than one instance of your bot:

{
	"apps": [{
		"name": "mybot.0",
		"interpreter": "/bin/bash",
		"watch": true,
		"ignore_watch" : ["client/img"],
		"script": "bin/hubot",
		"args": "-a rocketchat",
		"port": "3001",
		"env": {
			"ROCKETCHAT_URL": "https://localhost:3000",
			"ROCKETCHAT_ROOM": "general",
			"RESPOND_TO_DM": true,
			"ROCKETCHAT_USER": "mybot",
			"ROCKETCHAT_PASSWORD": "12345",
			"ROCKETCHAT_AUTH": "password",
			"HUBOT_LOG_LEVEL": "debug"
		}
	}, {
		"name": "mybot.1",
		"interpreter": "/bin/bash",
		"watch": true,
		"ignore_watch" : ["client/img"],
		"script": "bin/hubot",
		"args": "-a rocketchat",
		"port": "3002",
		"env": {
			"ROCKETCHAT_URL": "https://mycompany.rocket.chat",
			"ROCKETCHAT_ROOM": "general",
			"RESPOND_TO_DM": true,
			"ROCKETCHAT_USER": "mybot",
			"ROCKETCHAT_PASSWORD": "12345",
			"ROCKETCHAT_AUTH": "password",
			"HUBOT_LOG_LEVEL": "debug"
		}
	}
]
}

And of course, you can go nuts setting configs for different plataforms, like facebook mensenger, twitter or telegram ;P.

Hubot Adapters

Hubot comes with at least 38 adapters, including Rocket.Chat addapter of course.
To connect to your Rocket.Chat instance, you can set env variables, our config pm2 json file.

Checkout other hubot adapters for more info.

Thanks to

In Rocket.Chat we are so in love by what we do that we couldn't forget to thanks everyone that made it possible!

Github Hubot Team

Thanks guys for this amazing framework, hubots lives in the heart of Rocket.Chat, and we recommend everyone to checkout https://hubot.github.com and find much much more about hubot!

Natural Node Project

To the NaturalNode Team our most sincere "THAK YOU VERY MUCH!! We loved your project and we are excited to contribute!".
Checkout https://github.com/NaturalNode/natural and let your mind blow!

Digital Ocean's Heartbot

We can not thanks Digital Ocean enough, not only for this beautifull HeartBot project, but also for all the great tutorials and all the contributions to OpenSource moviment.

Thanks to Our Community

And for last but not least, thanks to our big community of contributors, testers, users, partners, and everybody who loves Rocket.Chat and made all this possible.

hubot-natural's People

Contributors

andreyluiz avatar bernardoetrevisan avatar danielbchaves avatar diegodorgam avatar duerno avatar ednunes avatar filipevoges avatar geekgonecrazy avatar jszaszvari avatar juliagrala avatar matheusfaria avatar matheusmiranda avatar ramonnobre avatar richieri avatar rodrigok avatar sing-li avatar yurireeis 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

hubot-natural's Issues

Supervised Learning

Today all the training comes from an YAML file.
If the users try some interaction against the bot that it's not trained to answer, the bot will return an error message, and nothing else.

The supervised learning skill is based on the ability of learn from it's mistakes.
So here what I'm thinking is to name a supervisor user to bot, and in every error, it sends a message to the user asking what it should respond, and then take the expected message and the answer to a new interaction node, and retrain the classifier with that new interaction node.

Any ideas?

Troca de nome dos campos nos arquivos de datasets

Os datasets em si fazem parte de um classificador só, e como eu já havia comentado com o @diegodorgam os nomes que aparecem nos datasets para frases que dão aquele sentido e suas respostas não estão claros.

Sugiro a troca dos nomes classifiers para expected_input e message para possible_answer

Decoupling from RocketChat

This project is tightly coupled with RocketChat. It would be interesting to decouple it to make sure that other adapters can use it.

Collect Form Data

THe bot must be able to collect information through the chat, like if the user was filling a form, but the data must come trough the chat, and be validated by the bot, befores is saved or sent somewhere.
Eg:

user > Hi I want to register
bot > What's is your name?
user > my name is John Doe
bot > thanks mr. John Doe. What is your e-mail address?
user > is [email protected]
bot > Sorry John Doe, that's not a valid e-mail address. Please answer with a valid e-mail address or type 'cancel'
user > my e-mail is [email protected]
bot > thank's Mr. John Doe, you registered into our newsletter with the e-mail address 
[email protected]. Please confirm your e-mail by clicking in the link I sent you.

Validation must come to all sorts of fields, text, date, e-mail and stuff. One good way to do this is to identify the information inside the message and run it against a RegExp pattern.

Python missing?

Hello!
I noticed a glitch with the docker image, I get:
docker logs hubot

> [email protected] install /home/hubotnat/bot/node_modules/webworker-threads
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:166:21)
gyp ERR! System Linux 3.16.0-7-amd64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/hubotnat/bot/node_modules/webworker-threads
gyp ERR! node -v v9.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of coffee-script@^1.12.6 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/webworker-threads):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 9 packages, removed 9 packages and updated 1 package in 10.691s
[Thu Dec 20 2018 10:05:53 GMT+0000 (GMT)] DEBUG Loading adapter rocketchat
[Thu Dec 20 2018 10:05:54 GMT+0000 (GMT)] INFO Starting Rocketchat adapter version 1.0.12...
[Thu Dec 20 2018 10:05:54 GMT+0000 (GMT)] INFO Once connected to rooms I will respond to the name: HubotNatural
[Thu Dec 20 2018 10:05:54 GMT+0000 (GMT)] INFO I will also respond to my Rocket.Chat username as an alias: Lane
[Thu Dec 20 2018 10:05:54 GMT+0000 (GMT)] INFO Connecting To: rocketchat:3000
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO Successfully connected!
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO Logging In
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO Successfully Logged In
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO rid:  []
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO All rooms joined.
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO Preparing Meteor Subscriptions..
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO Subscribing to Room: __my_messages__
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO Successfully subscribed to messages
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] INFO Setting up reactive message list...
[Thu Dec 20 2018 10:07:17 GMT+0000 (GMT)] DEBUG Loading scripts from /home/hubotnat/bot/scripts
Loading corpus: /home/hubotnat/bot/training_data/corpus.yml
[Thu Dec 20 2018 10:07:18 GMT+0000 (GMT)] INFO Calling: getUserRoles,
Processing interactions

Any idea?
Thx

corpus*.yml does not load out of the box

using node v6.10.3
Note that the cat example works fine. i was playing around how to get next and interactions working to see if we can chain some responses via some notion of context. (not sure if i quite get thats the correct usage.) none the less, had some issue with loading these yaml files.

the following errors are recorded when attempting to load corpus.yml and corpus-v1.yml

Tue Dec 12 2017 11:09:57 GMT+0100 (CET)] ERROR Unable to load /Users/yveshwang/github/hubot-natural/scripts/index: TypeError: Cannot read property 'find' of undefined
    at classifyInteraction (/Users/yveshwang/github/hubot-natural/scripts/bot/index.coffee:83:46)
    at global.train (/Users/yveshwang/github/hubot-natural/scripts/bot/index.coffee:177:9)
    at module.exports (/Users/yveshwang/github/hubot-natural/scripts/bot/index.coffee:183:10)
    at Robot.loadFile (/Users/yveshwang/github/hubot-natural/node_modules/hubot/src/robot.coffee:358:11)
    at Robot.load (/Users/yveshwang/github/hubot-natural/node_modules/hubot/src/robot.coffee:377:10)
    at RocketChatBotAdapter.loadScripts (/Users/yveshwang/github/hubot-natural/node_modules/hubot/bin/hubot:97:13)
    at RocketChatBotAdapter.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at RocketChatBotAdapter.emit (events.js:185:7)
    at /Users/yveshwang/github/hubot-natural/node_modules/hubot-rocketchat/src/rocketchat.coffee:212:6
    at _fulfilled (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:816:13)
    at /Users/yveshwang/github/hubot-natural/node_modules/q/q.js:624:44
    at runSingle (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:137:13)
    at flush (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

slightly diff error for corpus-sei.yml

[Tue Dec 12 2017 11:10:07 GMT+0100 (CET)] ERROR Unable to load /Users/yveshwang/github/hubot-natural/scripts/index: TypeError: Cannot read property 'substr' of undefined
    at global.train (/Users/yveshwang/github/hubot-natural/scripts/bot/index.coffee:174:14)
    at module.exports (/Users/yveshwang/github/hubot-natural/scripts/bot/index.coffee:183:10)
    at Robot.loadFile (/Users/yveshwang/github/hubot-natural/node_modules/hubot/src/robot.coffee:358:11)
    at Robot.load (/Users/yveshwang/github/hubot-natural/node_modules/hubot/src/robot.coffee:377:10)
    at RocketChatBotAdapter.loadScripts (/Users/yveshwang/github/hubot-natural/node_modules/hubot/bin/hubot:97:13)
    at RocketChatBotAdapter.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at RocketChatBotAdapter.emit (events.js:185:7)
    at /Users/yveshwang/github/hubot-natural/node_modules/hubot-rocketchat/src/rocketchat.coffee:212:6
    at _fulfilled (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:816:13)
    at /Users/yveshwang/github/hubot-natural/node_modules/q/q.js:624:44
    at runSingle (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:137:13)
    at flush (/Users/yveshwang/github/hubot-natural/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

HTTP router for hubot HealthCheck

When the bot dies, we don't have any notification.
There are a few possible situations where a bot can die, an outage of the server can be one of those.
But the thing is that we need to check if the bot is alive and able to post messages into the server, and the best way to do this is enabling a http endpoint where we can send a GET request and receive some data back.
For that we have a good example in https://leanpub.com/automation-and-monitoring-with-hubot/read#leanpub-auto-serving-http-requests
We could use some inspiration from hubot-diagnostics but remembering that we need to have the bots health information through http requests, for infrastructure checking purposes.

/assign @arthurTemporim

Identify Intents

We need to develop a way to identify users intent, to be used as an alternative navigation system, or even to be used with the classifier system.
One way to do this, i Identifying verbs in the message, using Brill PoS Tagger.

Named Entities Recognition

The bot must be able to identify entities in a message, and transform those entities into rich objects with attributes that can be used.
The Brill PoS Tagger can help to identify nouns in the message, but there is another challenge, to enrich the entity with attributes.

Any ideas?

External service routing method can’t transver bot to human agent

Hello i have some problem when integrating Rocket.chat with hubot-natural bot, i want to set my bot agent as default agent for every guest visiting live chat, so i set Livechat Routing Method as External Service, i made my own External Queue Service URL and set mybot details as the return from my endpoint as mention in documentation, and everything is going well.
the problem is when i using External Service routing method, i can’t transver bot agent to human agent when customer want to talk to human (it’s always return false, “there is no one online right now”), but if i using other routing method everything is going well, bot can transfer chat to other human agent as i wish.

thank you for your help …

Error installing hubot-natural

Hi! I'm trying to install hubot-natural.

I'm following the installations steps and got error on "npm install"

make: ** [Release/obj.target/WebWorkerThreads/src/WebWorkerThreads.o] Erro 1
make: Saindo do diretório `~/myBot/node_modules/webworker-threads/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 3.2.0-58-generic-pae
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd ~/myBot/node_modules/webworker-threads
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"ia32"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/webworker-threads):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 396 packages in 24.92s

Soved installing webworker-threads module

Sent from my Motorola XT1635-02 using FastHub

Enable natural conversataion

Can this be used along with hubot-conversation, to enable conversation while having a good feeling of talking to a human? Or some other way that will enable a conversation rather than request/reply.

Duplicate of Multi step conversation

Bot crashes when there is no error node and a high trust value

If you set a high trust value on your corpus, and do not define any error node. The bot crashes, since it can't define an interaction, and do not have an error node to fallback.

The good practice is to always have at least one error node, but we need to define a behavior since it is not mandatory.

Configure Event Classes to be loaded

The idea is to change the algorithm that loads all files in the events folder to some way that the user can configure it.
Options are:

  1. Set the events classes to be loaded in the YAML file, as an attribute like
events:
  - respond
  - configure
  - gitlab
...
  1. Read all the interactions nodes and load only what was specified in event attribute.
  2. Set a JSON file like hubot's external-scripts.json, something like events.json maybe
  3. Set an environment variable like HUBOT-EVENTS to be specified by the user.

Any thoughts?

Bot not answering in public and private groups

Got following error, saying res is not defined

[Thu Mar 29 2018 14:58:19 GMT+0000 (UTC)] ERROR ReferenceError: res is not defined
at createMatch (/home/hubotnat/bot/scripts/bot/index.coffee:40:3)
at TextListener.callback (/home/hubotnat/bot/scripts/bot/index.coffee:64:11)
at /home/hubotnat/bot/node_modules/hubot/src/listener.coffee:65:12
at allDone (/home/hubotnat/bot/node_modules/hubot/src/middleware.coffee:44:37)
at /home/hubotnat/bot/node_modules/async/lib/async.js:274:13
at Object.async.eachSeries (/home/hubotnat/bot/node_modules/async/lib/async.js:142:20)
at Object.async.reduce (/home/hubotnat/bot/node_modules/async/lib/async.js:268:15)
at /home/hubotnat/bot/node_modules/hubot/src/middleware.coffee:49:13
at process._tickCallback (internal/process/next_tick.js:112:11)

ENOENT: no such file or directory, lstat 'corpus.yml'

bin\hubot
npm WARN [email protected] requires a peer of coffee-script@^1.12.6 but none is installed. You must install peer dependencies yourself.

up to date in 6.152s
[Mon Mar 25 2019 17:44:38 GMT+0530 (India Standard Time)] DEBUG Loading adapter rocketchat
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Starting Rocketchat adapter version 1.0.12...
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Once connected to rooms I will respond to the name: ServiceDesk
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] WARNING No services ROCKETCHAT_ROOM provided to Hubot, using
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Connecting To: localhost:3000
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Successfully connected!
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Logging In
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Successfully Logged In
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO rid: []
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO All rooms joined.
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Preparing Meteor Subscriptions..
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Subscribing to Room: my_messages
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Successfully subscribed to messages
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] INFO Setting up reactive message list...
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] DEBUG Loading scripts from D:\BT\Rocket.Chat\RC\mybot\scripts
[Mon Mar 25 2019 17:44:39 GMT+0530 (India Standard Time)] DEBUG Parsing help for D:\BT\Rocket.Chat\RC\mybot\scripts\example.coffee
Loading corpus: corpus.yml
An error occurred while trying to load bot's config.
{ Error: ENOENT: no such file or directory, lstat 'corpus.yml'
at Object.lstatSync (fs.js:840:3)
at common.loadConfigfile (D:\BT\Rocket.Chat\RC\mybot\scripts\lib\common.coffee:72:11)
at Object. (D:\BT\Rocket.Chat\RC\mybot\scripts\index.coffee:7:19)
at Object. (D:\BT\Rocket.Chat\RC\mybot\scripts\index.coffee:1:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.loadFile (D:\BT\Rocket.Chat\RC\mybot\node_modules\coffeescript\lib\coffee-script\register.js:16:19)
at Module.load (D:\BT\Rocket.Chat\RC\mybot\node_modules\coffeescript\lib\coffee-script\register.js:45:36)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Robot.loadFile (D:\BT\Rocket.Chat\RC\mybot\node_modules\hubot\src\robot.coffee:355:18)
at Robot.load (D:\BT\Rocket.Chat\RC\mybot\node_modules\hubot\src\robot.coffee:377:10)
at RocketChatBotAdapter.loadScripts (D:\BT\Rocket.Chat\RC\mybot\node_modules\hubot\bin\hubot:93:11)
at Object.onceWrapper (events.js:277:13)
at RocketChatBotAdapter.emit (events.js:189:13)
at D:\BT\Rocket.Chat\RC\mybot\node_modules\hubot-rocketchat\src\rocketchat.coffee:212:6
at _fulfilled (D:\BT\Rocket.Chat\RC\mybot\node_modules\q\q.js:854:54)
at D:\BT\Rocket.Chat\RC\mybot\node_modules\q\q.js:883:30
at Promise.promise.promiseDispatch (D:\BT\Rocket.Chat\RC\mybot\node_modules\q\q.js:816:13)
at D:\BT\Rocket.Chat\RC\mybot\node_modules\q\q.js:624:44
at runSingle (D:\BT\Rocket.Chat\RC\mybot\node_modules\q\q.js:137:13)
at flush (D:\BT\Rocket.Chat\RC\mybot\node_modules\q\q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:61:11)

errno: -4058,
syscall: 'lstat',
code: 'ENOENT',
path: 'corpus.yml' }

No listeners executed

I made all instalation, executing as shown and just made change for environment of my instalation, but I get this error when I talk with the bot in rocket.chat.

DEBUG No listeners executed; falling back to catch-all

What I am doing wrong? May you help me?

I write a little script with env variables and start hubot, above is the output:

[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] DEBUG Loading adapter rocketchat
[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] INFO Starting Rocketchat adapter version 1.0.12...
[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] INFO Once connected to rooms I will respond to the name: Mybot
[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] INFO I will also respond to my Rocket.Chat username as an alias: mybot
[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] INFO Connecting To: 192.168.1.11:3000
[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] INFO Successfully connected!
[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] INFO GENERAL
[Tue Aug 04 2020 11:55:58 GMT-0300 (GMT-03:00)] INFO Logging In
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Successfully Logged In
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Looking up Room ID for: GENERAL
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Joining Room: GENERAL
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO rid: [ 'GENERAL' ]
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO All rooms joined.
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Successfully joined room: GENERAL
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Preparing Meteor Subscriptions..
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Subscribing to Room: my_messages
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Successfully subscribed to messages
[Tue Aug 04 2020 11:55:59 GMT-0300 (GMT-03:00)] INFO Setting up reactive message list...
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] INFO Message received with ID id
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] INFO Message receive callback id 4tA5zyoEEfcrSiXe7 ts Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] INFO [Incoming] admin: Oi
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] INFO Checking to see if method: getRoomNameById exists
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] INFO Looking up Room Name for: GENERAL
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] INFO setting roomName: general
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] INFO Message sent to hubot brain.
[Tue Aug 04 2020 11:56:11 GMT-0300 (GMT-03:00)] DEBUG No listeners executed; falling back to catch-all
[Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)] INFO Message received with ID id
[Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)] INFO Message receive callback id GzTwwsHfXvCN2Hmo5 ts Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)
[Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)] INFO [Incoming] admin: mybot oi
[Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)] DEBUG Found cached Room Name for GENERAL: general
[Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)] INFO setting roomName: general
[Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)] INFO Message sent to hubot brain.
[Tue Aug 04 2020 11:56:21 GMT-0300 (GMT-03:00)] DEBUG No listeners executed; falling back to catch-all
[Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)] INFO Message received with ID id
[Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)] INFO Message receive callback id k4d26nnzctevntEBf ts Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)
[Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)] INFO [Incoming] admin: @MYBOT oi
[Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)] DEBUG Found cached Room Name for GENERAL: general
[Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)] INFO setting roomName: general
[Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)] INFO Message sent to hubot brain.
[Tue Aug 04 2020 11:56:30 GMT-0300 (GMT-03:00)] DEBUG No listeners executed; falling back to catch-all

ERROR: Cannot locate specified Dockerfile: Dockerfile with docker-compose up

Hello, trying test hubot-natural, when run with docker compose, i have this error:

mazinger:~/rockethubot$ sudo docker-compose up
Creating network "rockethubot_default" with the default driver
Building hubot-natural
ERROR: Cannot locate specified Dockerfile: Dockerfile

mazinger:~/rockethubot$ docker --version
Docker version 18.09.1, build 4c52b90

Any ideas? Thanks.

callMethod undefined

I guess I missed something in the setup, I get:

found 22 vulnerabilities (11 low, 3 moderate, 8 high)
  run `npm audit fix` to fix them, or `npm audit` for details
test> Loading corpus: training_data/corpus.yml
[Wed Dec 19 2018 13:13:22 GMT+0100 (GMT+01:00)] ERROR Unable to load E:\hubot-natural\scripts\index: TypeError: Cannot read property 'callMethod' of undefined
    at security.getUserRoles (E:\hubot-natural\scripts\lib\security.coffee:5:28)
    at module.exports (E:\hubot-natural\scripts\bot\index.coffee:45:26)
    at Robot.loadFile (E:\hubot-natural\node_modules\hubot\src\robot.coffee:358:11)
    at Robot.load (E:\hubot-natural\node_modules\hubot\src\robot.coffee:377:10)
    at Shell.loadScripts (E:\hubot-natural\node_modules\hubot\bin\hubot:93:11)
    at Object.onceWrapper (events.js:273:13)
    at Shell.emit (events.js:182:13)
    at E:\hubot-natural\node_modules\hubot\src\adapters\shell.coffee:35:8
    at E:\hubot-natural\node_modules\hubot\src\adapters\shell.coffee:101:9
    at suppressedCallback (fs.js:200:5)
    at FSReqWrap.oncomplete (fs.js:141:20)

Any idea?

hubot-natural package missing on NPM

I notice that the hubot-natural package was never uploaded to the NPM. It would be interesting to upload it. To do that I think that the package.json version needs to be reviewed and it would be awesome to have an npm bagde on the README.

Bot not leaving livechat after transfer to live agent.

Hi,

I'm having an issue where by hubot-natural chatbot does not leave a livechat session after it has handed off to a live agent.

Using the stock "rocketcat-en.yml" corpus, I have updated the file to include the proper Department hash. When requesting to talk with a human, a live agent is assigned and joins the chat, but the bot is also still present and continues to try and answer as well.

Is there a setting I am missing? It's hard to nail down the config since the images in the instructions are all broken.

Andrew

Load more than one YAML Corpus

Makes sense to load more than one YAML corpus?

Some people have asked about this, so they would be able to develop a YAML corpus specialized in some context area, our some specific subject in different files so it would be easier to develop, share and contribute.

What you think about it?

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.