相关疑难解决方法(0)

在HTTP POST请求中将Sland发送给Slack

我正在尝试使用Slack的chat.postMessage API调用发送消息.我在HTTP GET中编码测试消息没有问题,但我试图在HTTP POST请求中使用JSON实现相同的结果.

我一直在curlPostman一起测试,但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)

我之前没有做过这样的事情,所以我不确定我是否遗漏了一些东西.谢谢!

api json slack-api

40
推荐指数
6
解决办法
4万
查看次数

标签 统计

api ×1

json ×1

slack-api ×1