2013-03-07 56 views
24

我想将http-post-say.coffee脚本添加到Heroku上托管的hubot应用程序。Add Hub支持Hubot

该文档指出,一旦添加了该脚本,它将创建'/hubot/say'路由,该路由接受以下格式的发布请求。

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

我加入了脚本和修改网址,但我收到以下错误: Cannot POST /hubot/say

我的下一步是添加一些依赖。我注意到使用robot.router.post的其他应用程序具有这些依赖关系。

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

我部署了我的变化,但我仍然收到Cannot POST /hubot/say,当我尝试打这条路线。

有什么我失踪?我对node.js或hubot不是很熟悉。

+0

你在添加文件夹? 'scripts'? – Outsider 2013-05-15 04:55:02

+1

日志说什么? – maletor 2013-06-19 21:14:56

+0

解决了?我试过你的脚本,它工作正常http:// localhost:8080/hubot/say?message = lala&room =#dev – 2014-03-07 01:13:48

回答

1

要加载在Hubot内置的脚本,你必须将其添加到hubot-scripts.json,如:

["http-post-say.coffee"] 

(由于脚本本身看起来很好,它听起来就像你被推到Heroku的(重启Hubot )这是我能想到的唯一的事情,这将解释它不起作用。)

1

你必须明白,一旦你将你的代码推到heroku上并使它在那里运行,URL不再是localhost,而是实际的heroku与您创建机器时相关的URL heroku create

的URL看起来应该是这样的:

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