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

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

Open
vicendominguez opened this issue Apr 20, 2015 · 5 comments

Comments

@vicendominguez
Copy link

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
Copy link

thakyuu commented Apr 23, 2015

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
Copy link
Author

Very interesting @thakyuu,

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

Thx

@bubblemanss
Copy link

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

@thakyuu
Copy link

thakyuu commented Apr 23, 2015

  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
Copy link
Author

yeah... thank you guys!!! good tricks! 👍

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