Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

robot messageRoom not working #69

Open
kmejka opened this issue Dec 10, 2014 · 20 comments
Open

robot messageRoom not working #69

kmejka opened this issue Dec 10, 2014 · 20 comments

Comments

@kmejka
Copy link

kmejka commented Dec 10, 2014

Hi,
I've wanted to try out the messageRoom functionality. Unfortunately I'm having problems with it, either my script is wrong, or I'm using it wrong.The script I wrote essentially does nothing (apart from logging to console). All i get is an entry in the logs: 2014-12-10_12:38:28.19080 [Wed Dec 10 2014 12:38:28 GMT+0000 (UTC)] DEBUG Message 'hubot test222222' matched regex //^[@]?hubot[:,]?\s*(?:test222222)/i/ 2014-12-10_12:38:28.19116 sent message. Any help would be appreciated.
The script:

module.exports = (robot) ->
    robot.respond /test222222/i, (msg) ->
        room = '624dbb2a-64c4-4e74-8bda-05ce7d4856ab'
        robot.messageRoom room, 'Hello'
        console.log 'sent message'

I got the room id, by doing a call to the flowdock api, like this:

curl -X GET https://<user>:<pass>@api.flowdock.com/flows

My setup:

"dependencies": {
    "coffee-script":      "1.6.3",
    "hubot-flowdock":     "0.6.0",
    "optparse":           "1.0.4",
    "scoped-http-client": "0.9.8",
    "log":                "1.4.0",
    "express":            "3.3.4",
    "aws-sdk" :           "2.0.29"
  },

hubot version - 2.4.6

@Mumakil
Copy link
Contributor

Mumakil commented Dec 10, 2014

You are using an old version of the adapter, the current one is 0.7.2. What's the hubot version you're running?

@kmejka
Copy link
Author

kmejka commented Dec 10, 2014

Hubot version is 2.7.4 (I made a mistake and wrote 2.4.6 in my first message).
Should I update to a newest version of the adapter and then check again?

@Mumakil
Copy link
Contributor

Mumakil commented Dec 10, 2014

Yes please. The 0.6 is using an older api package version too so that might break things too.

@kmejka
Copy link
Author

kmejka commented Dec 11, 2014

I've changed to 0.7.2 and I'm still getting nothing.

@Mumakil
Copy link
Contributor

Mumakil commented Dec 11, 2014

I'm testing with this script (message-room.coffee) in https://gist.github.com/Mumakil/1a8b2f12c82c6cc04b89 and it works fine. Could you try if you can get any debug information with the error-handler.coffee in the same gist? It adds an error handler to hubot and logs all errors (and also tries to post the error to the first flow it knows about). Also, I didn't notice this before, but the hubot version you're using is somewhat old too. Current is 2.10.0. I've been testing with 2.9.3.

@kmejka
Copy link
Author

kmejka commented Jan 30, 2015

Hi,
Sorry for the lag, but I've had other issues at work on which I had to focus.
Anyway I've tested on a fresh install of hubot, generated using yeoman. The result is similar only I've used the code from @Mumakil gist. On flowdock I can't find anything, I've got this message in the logs:

kmejka@kmejka ~/D/hubot> ./bin/hubot -a flowdock 
connect deprecated multipart: use parser (multiparty, busboy, formidable) npm module instead node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:56:20
connect deprecated limit: Restrict request size at location of read node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/multipart.js:86:15
[Fri Jan 30 2015 15:57:57 GMT+0100 (CET)] INFO /home/kmejka/Dokumenty/hubot/scripts/error-handler.coffee is using deprecated documentation syntax
[Fri Jan 30 2015 15:57:57 GMT+0100 (CET)] INFO /home/kmejka/Dokumenty/hubot/scripts/message-room.coffee is using deprecated documentation syntax
[Fri Jan 30 2015 15:57:58 GMT+0100 (CET)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s  | grep web_url | cut -d= -f2)`
[Fri Jan 30 2015 15:57:58 GMT+0100 (CET)] INFO Using default redis on localhost:6379
[Fri Jan 30 2015 15:57:58 GMT+0100 (CET)] INFO Data for hubot brain retrieved from Redis
[Fri Jan 30 2015 15:57:58 GMT+0100 (CET)] INFO Found 7 flows.
[Fri Jan 30 2015 15:57:58 GMT+0100 (CET)] INFO Connecting to Flowdock as user Hubot (id 76465).
[Fri Jan 30 2015 15:57:58 GMT+0100 (CET)] INFO Flowdock: connecting
[Fri Jan 30 2015 15:57:59 GMT+0100 (CET)] INFO Flowdock: connected and streaming
[Fri Jan 30 2015 15:58:16 GMT+0100 (CET)] ERROR Unexpected error in Flowdock client: Error: Received status 403
[Fri Jan 30 2015 15:58:20 GMT+0100 (CET)] ERROR Unexpected error in Flowdock client: Error: Received status 403

My package.json file:

{
  "name": "y",
  "version": "0.0.0",
  "private": true,
  "author": "y",
  "description": "y",
  "dependencies": {
    "hubot": "^2.11.0",
    "hubot-diagnostics": "0.0.1",
    "hubot-flowdock": "^0.7.3",
    "hubot-google-images": "^0.1.2",
    "hubot-google-translate": "^0.1.0",
    "hubot-help": "^0.1.1",
    "hubot-heroku-keepalive": "0.0.4",
    "hubot-maps": "0.0.1",
    "hubot-pugme": "^0.1.0",
    "hubot-redis-brain": "0.0.2",
    "hubot-rules": "^0.1.0",
    "hubot-scripts": "^2.5.16",
    "hubot-shipit": "^0.1.1",
    "hubot-youtube": "^0.1.2"
  },
  "engines": {
    "node": "0.10.x"
  }
}

@Mumakil
Copy link
Contributor

Mumakil commented Feb 2, 2015

It seems you are receiving 403 errors from the API, which means the bot probably isn't part of that flow, so it's not allowed to post to the flow. Could you double check that you can see the bot in the flow you're trying to post to and reconnect the bot (newest version of hubot-flowdock 0.7.4 reconnects automatically if flows change).

@kmejka
Copy link
Author

kmejka commented Feb 2, 2015

I've checked flowdock and the robot is part of the flow, it is displayed there. I can communicate with it and the robot responds. I'll update to the newest version and check then.

@kmejka
Copy link
Author

kmejka commented Feb 2, 2015

I did a clean install of hubot, with the newest flowdock adapter. I've got the 0.7.4 flowdock adapter in package.json. I checked, hubot is mentioned as a member of the flow (named kato), in status online. I tried using the command in three ways:
hubot message room kato test using the parametrized name of the flow
hubot message room Kato test using the name of the flow
hubot message room 624dbb2a-#################### using the id (I hid it for security purposes) of the flow

All of these ways failed (no message in flow), for the first two I got an error in the console, ERROR Unexpected error in Flowdock client: Error: Received status 403 and for the third - nothing was mentioned in the console.

@kmejka
Copy link
Author

kmejka commented Feb 5, 2015

@Mumakil any update?

@Mumakil
Copy link
Contributor

Mumakil commented Feb 6, 2015

Sorry, couldn't figure out what might be wrong by looking at our logs. Your bot/flows seem to be in correct shape too. By the way, the last format is the correct one, you need to give the message room the actual id of the flow that's being used (what the flows endpoint returns).

To debug, you could add logging to the node-flowdock adapter (should be in node_modules/hubot-flowdock/node_modules/flowdock). From there, open lib/flowdock.js and around line 99 in the request callback you can try console.log(err, res, body), which should give you the error message returned by our api.

@kmejka
Copy link
Author

kmejka commented Feb 9, 2015

I have changed the flowdock.js file, I've added this line:

     return request(options, (function(_this) {
        return function(err, res, body) {
          console.log(err, res, body);
          var error;
          if (err) {
             ...

Unfortunately I don't see anything in the logs. If I use to full long id I get nothing in the logs, but the message does not appear in the flow. If I use a wrong flow id (or the flow name) I get a really long message in the logs with the full json of the error, with the message somewhere message: 'Invalid flow identifier',.
This is the startup message of hubot, maybe something here is wrong?

kmejka@kmejka-work ~/D/hubot> ./bin/hubot -a flowdock 
connect deprecated multipart: use parser (multiparty, busboy, formidable) npm module instead node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:56:20
connect deprecated limit: Restrict request size at location of read node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/multipart.js:86:15
[Mon Feb 09 2015 14:54:35 GMT+0100 (CET)] INFO Ignoring all messages from user ids 0
[Mon Feb 09 2015 14:54:35 GMT+0100 (CET)] WARNING Expected /home/kmejka/Dokumenty/hubot/scripts/deployToStack to assign a function to module.exports, got object
[Mon Feb 09 2015 14:54:35 GMT+0100 (CET)] INFO /home/kmejka/Dokumenty/hubot/scripts/error-handler.coffee is using deprecated documentation syntax
[Mon Feb 09 2015 14:54:35 GMT+0100 (CET)] INFO /home/kmejka/Dokumenty/hubot/scripts/message-room.coffee is using deprecated documentation syntax
[Mon Feb 09 2015 14:54:35 GMT+0100 (CET)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s  | grep web_url | cut -d= -f2)`
[Mon Feb 09 2015 14:54:35 GMT+0100 (CET)] INFO Using default redis on localhost:6379
[Mon Feb 09 2015 14:54:36 GMT+0100 (CET)] INFO Found 7 flows.
[Mon Feb 09 2015 14:54:36 GMT+0100 (CET)] INFO Connecting to Flowdock as user Hubot (id 76465).
[Mon Feb 09 2015 14:54:36 GMT+0100 (CET)] INFO Flowdock: connecting
[Mon Feb 09 2015 14:54:37 GMT+0100 (CET)] INFO Flowdock: connected and streaming

@kmejka
Copy link
Author

kmejka commented Feb 16, 2015

@Mumakil any update?
Maybe there is something wrong with your script? I've written a test script with the room id hardcoded and it works, but I don't see any reason why this works and your doesn't. Do you have any ideas?

module.exports = (robot) ->
  robot.respond /test/i, (msg) ->
    console.log 'starting test'
    robot.messageRoom '624dbb2a-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx', 'dupa2'

@Mumakil
Copy link
Contributor

Mumakil commented May 7, 2015

Sorry it took so long to figure out what's wrong: my script had a flaw in the Regex and didn't recognize id's with dashes... I've updated the gist above! There are also some other stability updates.

@VijayBI
Copy link

VijayBI commented Apr 6, 2016

@Mumakil and @anttipitkanen, how can we make sure our hubot is part of flowdock... here i am using following environment to set up hubot-flowdock integration...

System environment :
OS : Windows 7
Enterprise Flowdock Version : 1.0.2.0
npm version: 3.4.1
Node.js version: 5.1.0
Hubot : ^2.18.0
Hubot-Flowdock adaptor : 0.7.6

Also used Following Environment variables...

HUBOT_FLOWDOCK_API_TOKEN
HUBOT_FLOWDOCK_LOGIN_EMAIL
HUBOT_FLOWDOCK_LOGIN_PASSWORD
HUBOT_NAME : Which is same as flowdock login page name
HUBOT_FLOWDOCK_ALLOW_ANONYMOUS_COMMANDS=1

Also i am able to listening all available flows in Flowdock using windows CMD console....Following is the console display

C:\hubot>bin\hubot -a flowdock
[Wed Apr 06 2016 14:43:12 GMT+0530 (India Standard Time)] ERROR hubot-heroku-ali
ve included, but missing HUBOT_HEROKU_KEEPALIVE_URL. heroku config:set HUBOT_HE ROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web-url | cut -d= -f2)
[Wed Apr 06 2016 14:43:12 GMT+0530 (India Standard Time)] INFO hubot-redis-brain
: Using default redis on localhost:6379
[Wed Apr 06 2016 14:43:17 GMT+0530 (India Standard Time)] INFO Found 3 flows, an
d I have joined 3 of them.
[Wed Apr 06 2016 14:43:17 GMT+0530 (India Standard Time)] INFO Connecting to Flo
wdock as user vijaykumar (id 187357).
[Wed Apr 06 2016 14:43:17 GMT+0530 (India Standard Time)] INFO Flowdock: connect
ing
[Wed Apr 06 2016 14:43:19 GMT+0530 (India Standard Time)] INFO Flowdock: connect
ed and streaming
[Wed Apr 06 2016 14:43:19 GMT+0530 (India Standard Time)] INFO Flowdock: listeni
ng to flows: tsoindia, GHE-Team, SCM-Team

Then i tried to chat with hubot with some default commands from respective flows...for which i have written coffee script with flow id....but i am not able get response. whereas working fine with shell as a adapter...

Do let me know how to get hubot is residing in flowdock after successful streaming with flowdock.... or please do mention steps to inviting hubot in flowdock's room and how to test the integration successful...

@VijayBI
Copy link

VijayBI commented Apr 6, 2016

It will be great if anyone address this issue....

@kmejka
Copy link
Author

kmejka commented Apr 6, 2016

@VijayBI sorry I'm not a developer on the hubot, hubot-flowdock or flowodck projects. I was just a user of hubot who needed some problem to be solved. Please address this issue to the maintainers of the hubot or hubot-flowdock projects.
I read the problem description that you've provided and I'm sorry to say I don't know how to help you.

@VijayBI
Copy link

VijayBI commented Apr 7, 2016

@kmejka its ok, thanks...

@VijayBI
Copy link

VijayBI commented Apr 8, 2016

@Mumakil and @anttipitkanen, how can we make sure our hubot is part of flowdock... here i am using following environment to set up hubot-flowdock integration...

System environment :
OS : Windows 7
Enterprise Flowdock Version : 1.0.2.0
npm version: 3.4.1
Node.js version: 5.1.0
Hubot : ^2.18.0
Hubot-Flowdock adaptor : 0.7.6

Also used Following Environment variables...

HUBOT_FLOWDOCK_API_TOKEN
HUBOT_FLOWDOCK_LOGIN_EMAIL
HUBOT_FLOWDOCK_LOGIN_PASSWORD
HUBOT_NAME : Which is same as flowdock login page name
HUBOT_FLOWDOCK_ALLOW_ANONYMOUS_COMMANDS=1

Also i am able to listening all available flows in Flowdock using windows CMD console....Following is the console display

C:\hubot>bin\hubot -a flowdock
[Wed Apr 06 2016 14:43:12 GMT+0530 (India Standard Time)] ERROR hubot-heroku-ali
ve included, but missing HUBOT_HEROKU_KEEPALIVE_URL. heroku config:set HUBOT_HE ROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web-url | cut -d= -f2)
[Wed Apr 06 2016 14:43:12 GMT+0530 (India Standard Time)] INFO hubot-redis-brain
: Using default redis on localhost:6379
[Wed Apr 06 2016 14:43:17 GMT+0530 (India Standard Time)] INFO Found 3 flows, an
d I have joined 3 of them.
[Wed Apr 06 2016 14:43:17 GMT+0530 (India Standard Time)] INFO Connecting to Flo
wdock as user vijaykumar (id 187357).
[Wed Apr 06 2016 14:43:17 GMT+0530 (India Standard Time)] INFO Flowdock: connect
ing
[Wed Apr 06 2016 14:43:19 GMT+0530 (India Standard Time)] INFO Flowdock: connect
ed and streaming
[Wed Apr 06 2016 14:43:19 GMT+0530 (India Standard Time)] INFO Flowdock: listeni
ng to flows: tsoindia, GHE-Team, SCM-Team

Then i tried to chat with hubot with some default commands from respective flows...for which i have written coffee script with flow id....but i am not able get response. whereas working fine with shell as a adapter...

Do let me know how to get hubot is residing in flowdock after successful streaming with flowdock.... or please do mention steps to inviting hubot in flowdock's room and how to test the integration successful...

@Mumakil
Copy link
Contributor

Mumakil commented Apr 11, 2016

@VijayBI sorry, neither of us is working for Flowdock anymore so I doubt we'll be of much use. You should probably contact [email protected] if nobody's reading these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants