最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add Post support to Hubot - Stack Overflow

programmeradmin0浏览0评论

I am trying to add the http-post-say.coffee script to a hubot app which is hosted on Heroku.

The documentation indicates that once you add the script then it creates the '/hubot/say' route which accepts post requests in the following format.

curl -X POST http://localhost:8080/hubot/say -d message=lala -d room='#dev'

I added the script and modified the url but I received the following error: Cannot POST /hubot/say

My next step was to add some dependencies. I noticed that other apps using robot.router.post had these dependencies.

"htmlparser": "1.7.6",
"connect": "2.3.4",
"connect_router": "1.8.6",
"scoped-http-client": "0.9.7"

I deployed my changes but I still receive Cannot POST /hubot/say when I try to hit that route.

Is there anything that I'm missing? I'm not very familiar with Node.js or hubot.

I am trying to add the http-post-say.coffee script to a hubot app which is hosted on Heroku.

The documentation indicates that once you add the script then it creates the '/hubot/say' route which accepts post requests in the following format.

curl -X POST http://localhost:8080/hubot/say -d message=lala -d room='#dev'

I added the script and modified the url but I received the following error: Cannot POST /hubot/say

My next step was to add some dependencies. I noticed that other apps using robot.router.post had these dependencies.

"htmlparser": "1.7.6",
"connect": "2.3.4",
"connect_router": "1.8.6",
"scoped-http-client": "0.9.7"

I deployed my changes but I still receive Cannot POST /hubot/say when I try to hit that route.

Is there anything that I'm missing? I'm not very familiar with Node.js or hubot.

Share Improve this question edited Oct 16, 2018 at 15:41 hong4rc 4,1234 gold badges23 silver badges42 bronze badges asked Mar 7, 2013 at 14:40 DruDru 9,82014 gold badges51 silver badges68 bronze badges 5
  • which folder do you add in? scripts? – Outsider Commented May 15, 2013 at 4:55
  • 1 What do the logs say? – maletor Commented Jun 19, 2013 at 21:14
  • solved? i tried your script, it works fine localhost:8080/hubot/say?message=lala&room=#dev – Larry Cai Commented Mar 7, 2014 at 1:13
  • 1 When you added the http-post-say.coffee script did you also quit and restart the hubot instance? Changes don't take effect unless the hubot restarts. Also you said you deployed to heroku, were you expecting the heroku hubot to respond to localhost:8080? Or did you also have a local instance running for testing? – Sukima Commented Jan 29, 2015 at 13:33
  • could it be a permissions issue on the http-post-say.coffee file? – cpk Commented Feb 23, 2015 at 8:54
Add a ment  | 

2 Answers 2

Reset to default 2

You have to understand that once you push your code on to heroku and make it run there, the URL no longer would be localhost but the actual heroku URL related to the machine that was created when you did heroku create.

The URL should look something like:

curl -X POST `http://herokumachinename/hubot/say -d message=lala -d room='#dev'`

To load a built-in script in Hubot, you must add it to hubot-scripts.json, e.g.:

["http-post-say.coffee"]

(Since the script itself looks fine and it sounds like you've pushed to Heroku (restarting Hubot) it's the only thing I can think of that would explain it not working.)

发布评论

评论列表(0)

  1. 暂无评论