Slack Webhook 忽略了我的一些参数
Slack Webhook is ignoring some of my params
我正在使用 slack webhook 来 post 一份报告,我正在尝试添加 icon_emoji
、channel
和 username
,但是它忽略了所有这些
当我在这里尝试使用它时它起作用了
https://api.slack.com/docs/messages/builder?msg=%7B%22username%22%3A%22Report%20notifier%22%2C%22channel%22%3A%22%23general%22%2C%22text%22%3A%22New%20Report%20%3C!everyone%3E%20%3C!here%3E%22%2C%22icon_emoji%22%3A%22%3Asmiley_cat%3A%22%2C%22attachments%22%3A%5B%7B%22text%22%3A%22And%20here%E2%80%99s%20an%20attachment!%22%7D%5D%7D
{ username: "Report notifier",
channel:"#general",
text: "New Report <!everyone> <!here>",
icon_emoji:':smiley_cat:',
attachments: [
{
color: "#FF0000",
fields: [
{
title: "price",
value: "4",
short: true,
},
],
},
],
};
首先,你的代码不是JSON。 Slack 需要 JSON 数据输入。
其次,频道名称必须是没有可见性图标的名称(#
等)
第三,使用表情符号需要设置权限-更多信息在here.
这有效(没有表情符号 - 我没有设置表情符号权限):
{
"username": "Report notifier",
"channel": "general",
"text": "New Report <!everyone> <!here>",
"icon_emoji": ":smiley_cat:",
"attachments": [
{
"color": "#FF0000",
"fields": [
{
"title": "price",
"value": "4",
"short": true,
}
]
}
]
}
我正在使用 slack webhook 来 post 一份报告,我正在尝试添加 icon_emoji
、channel
和 username
,但是它忽略了所有这些
当我在这里尝试使用它时它起作用了
https://api.slack.com/docs/messages/builder?msg=%7B%22username%22%3A%22Report%20notifier%22%2C%22channel%22%3A%22%23general%22%2C%22text%22%3A%22New%20Report%20%3C!everyone%3E%20%3C!here%3E%22%2C%22icon_emoji%22%3A%22%3Asmiley_cat%3A%22%2C%22attachments%22%3A%5B%7B%22text%22%3A%22And%20here%E2%80%99s%20an%20attachment!%22%7D%5D%7D
{ username: "Report notifier",
channel:"#general",
text: "New Report <!everyone> <!here>",
icon_emoji:':smiley_cat:',
attachments: [
{
color: "#FF0000",
fields: [
{
title: "price",
value: "4",
short: true,
},
],
},
],
};
首先,你的代码不是JSON。 Slack 需要 JSON 数据输入。
其次,频道名称必须是没有可见性图标的名称(#
等)
第三,使用表情符号需要设置权限-更多信息在here.
这有效(没有表情符号 - 我没有设置表情符号权限):
{
"username": "Report notifier",
"channel": "general",
"text": "New Report <!everyone> <!here>",
"icon_emoji": ":smiley_cat:",
"attachments": [
{
"color": "#FF0000",
"fields": [
{
"title": "price",
"value": "4",
"short": true,
}
]
}
]
}