我正在尝试使用Slack的chat.postMessage API调用发送消息.我在HTTP GET中编码测试消息没有问题,但我试图在HTTP POST请求中使用JSON实现相同的结果.
我一直在curl和Postman一起测试,但Slack似乎根本没有承认我的请求体.
{
"ok": false,
"error": "not_authed"
}
Run Code Online (Sandbox Code Playgroud)
在curl,我的请求编码如下:
curl -H "Content-type: application/json" -X POST -d '{"token":"my-token-here","channel":"#channel-name-or-id","text":"Text here.","username":"otherusername"}'
Run Code Online (Sandbox Code Playgroud)
在邮递员中,这是原始身体:
{
"token":"my-token-here",
"channel":"#channel-name-or-id",
"text":"Text here.",
"username":"otherusername"
}
Run Code Online (Sandbox Code Playgroud)
我之前没有做过这样的事情,所以我不确定我是否遗漏了一些东西.谢谢!
我目前正在使用
gem 'rails', '~> 5.0.0'
Run Code Online (Sandbox Code Playgroud)
在我的Gemfile中。
我刚刚了解了指定Rails分支的另一种方法,即:
gem 'rails', github: "rails/rails", branch: '5-0-stable'
Run Code Online (Sandbox Code Playgroud)
是否有最佳实践将Rails包含在Gemfile中?您为什么要使用一种方法来替代另一种方法?