Slack API: 如何在点击按钮时在消息中添加用户头像?
Slack API: How to add user avatars in message when they click a button?
我认为块工具包文档中有些内容我还没有读过,但我很好奇如何在块中显示用户头像,如下面的示例图片所示?干杯。
此模板可在 Block Kit BuilderApp 模板
中找到
https://api.slack.com/tools/block-kit-builder?template=1
Search for Poll after opening app templates.
头像,
需要使用https://api.slack.com/methods/users.info
获取头像url。
格式化,
这是您感兴趣的区块:
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_1.png",
"alt_text": "Michael Scott"
},
{
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_2.png",
"alt_text": "Dwight Schrute"
},
{
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_3.png",
"alt_text": "Pam Beasely"
},
{
"type": "plain_text",
"emoji": true,
"text": "3 votes"
}
]
}
截图
我认为块工具包文档中有些内容我还没有读过,但我很好奇如何在块中显示用户头像,如下面的示例图片所示?干杯。
此模板可在 Block Kit BuilderApp 模板
中找到https://api.slack.com/tools/block-kit-builder?template=1
Search for Poll after opening app templates.
头像,
需要使用https://api.slack.com/methods/users.info
获取头像url。
格式化,
这是您感兴趣的区块:
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_1.png",
"alt_text": "Michael Scott"
},
{
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_2.png",
"alt_text": "Dwight Schrute"
},
{
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_3.png",
"alt_text": "Pam Beasely"
},
{
"type": "plain_text",
"emoji": true,
"text": "3 votes"
}
]
}
截图