如何在 Slack 附件的字段选项中添加 URL?
How do I add a URL inside the field option in a Slack attachment?
我正在尝试从外部来源向 Slack 频道发送通知。我试图将 URL link 放在附件的字段标记内。有办法吗?
{
"attachments": [
{
"fallback": "Required plain-text summary of the attachment.",
"color": "#36a64f",
"pretext": "Optional text that appears above the attachment block",
"author_name": "Bobby Tables",
"author_link": "http://flickr.com/bobby/",
"author_icon": "http://flickr.com/icons/bobby.jpg",
"title": "Slack API Documentation",
"title_link": "https://api.slack.com/",
"text": "Optional text that appears within the attachment",
"fields": [
{
"title": "Priority",
"value": "High",
"short": false
}
],
"image_url": "http://my-website.com/path/to/image.jpg",
"thumb_url": "http://example.com/path/to/thumb.png"
}
]
}
是的,您可以在字段中使用 URL。但它只适用于 value
标签。在那里你甚至可以使用标记。
下面是 PHP 中的示例:
$slack->addAttachment( array (
"fallback" => "Fallback",
"title" => "Title",
"text" => "text",
"fields" => array (
array (
"title" => "Priority",
"value" => "<http://i.imgur.com/nwo13SM.png|test>",
"short" => false
)
)
));
我正在尝试从外部来源向 Slack 频道发送通知。我试图将 URL link 放在附件的字段标记内。有办法吗?
{
"attachments": [
{
"fallback": "Required plain-text summary of the attachment.",
"color": "#36a64f",
"pretext": "Optional text that appears above the attachment block",
"author_name": "Bobby Tables",
"author_link": "http://flickr.com/bobby/",
"author_icon": "http://flickr.com/icons/bobby.jpg",
"title": "Slack API Documentation",
"title_link": "https://api.slack.com/",
"text": "Optional text that appears within the attachment",
"fields": [
{
"title": "Priority",
"value": "High",
"short": false
}
],
"image_url": "http://my-website.com/path/to/image.jpg",
"thumb_url": "http://example.com/path/to/thumb.png"
}
]
}
是的,您可以在字段中使用 URL。但它只适用于 value
标签。在那里你甚至可以使用标记。
下面是 PHP 中的示例:
$slack->addAttachment( array (
"fallback" => "Fallback",
"title" => "Title",
"text" => "text",
"fields" => array (
array (
"title" => "Priority",
"value" => "<http://i.imgur.com/nwo13SM.png|test>",
"short" => false
)
)
));