groupby / hubot-hangups

Hubot adapter using hangups
39 stars 3 forks source link

How to make compatible http-post-say script with hubot-hangups adapter? #27

Open vicendominguez opened 9 years ago

vicendominguez commented 9 years ago

hey guys... thank you for this adapter.

I am trying to make compatible this adapter with the http-post-say core script with no luck.... It seems not to get any user.name valid property and i got this exception:

[Mon Apr 20 2015 17:25:41 GMT+0200 (CEST)] INFO Message 'testtestest' received for room hubot
TypeError: Cannot read property 'name' of undefined
  at HangoutsAdapter.send (/opt/hubot/node_modules/hubot-hangups/index.coffee:30:9, <js>:49:30)
  at Robot.send (/opt/hubot/node_modules/hubot/src/robot.coffee:404:19, <js>:372:42)
  at /opt/hubot/node_modules/hubot-scripts/src/scripts/http-post-say.coffee:37:7, <js>:12:15
  at callbacks (/opt/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:164:37)
  at param (/opt/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:138:11)
  at pass (/opt/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:145:5)
  at Router._dispatch (/opt/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:173:5)
  at Object.router (/opt/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:33:10)
  at next (/opt/hubot/node_modules/hubot/node_modules/express/node_modules/connect/lib/proto.js:169:15)
  at Object.multipart [as handle] (/opt/hubot/node_modules/hubot/node_modules/connect-multiparty/index.js:42:27)
  at next (/opt/hubot/node_modules/hubot/node_modules/express/node_modules/connect/lib/proto.js:169:15)
  at /opt/hubot/node_modules/hubot/node_modules/express/node_modules/connect/node_modules/body-parser/lib/read.js:107:5
  at IncomingMessage.onEnd (/opt/hubot/node_modules/hubot/node_modules/express/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:136:7)
  at IncomingMessage.g (events.js:180:16)
  at IncomingMessage.emit (events.js:92:17)
  at _stream_readable.js:943:16
  at process._tickCallback (node.js:419:13)

my testing curl line is:

curl -v http://localhost:8080/hubot/say -d message=testtestest -d room='hubot'

Any idea?

thakyuu commented 9 years ago

I using this. curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"conversationId":"#Replace-conversation-id#","message":"#Replace-message#"}' http://localhost:8081/proxy/

vicendominguez commented 9 years ago

Very interesting @thakyuu,

one more question, Where could I get the conversationId field?

Thx

bubblemanss commented 9 years ago

You can console.log the conversationId in the index.coffee when you send hubot a message using the adapter

thakyuu commented 9 years ago
  1. Placing this script.
  2. run hubot
  3. send "please id"

hubot/scripts/getId.coffee

#  Description
#    Get conversationId
#
#  Commands:
#    please id
module.exports = (robot) ->
  robot.hear /please id/i, (msg) ->
    msg.send "conversationId is #{msg.message.user.options.conversationId}"
vicendominguez commented 9 years ago

yeah... thank you guys!!! good tricks! :+1: