我们如何在使用 Slack 的 Block Kit Builder 时提及或标记某人?
我尝试创建 Slack 的块套件构建器,所需的设计实际上很好。但我不知道在哪里可以找到一个按钮,以便我们可以在上面标记某人。
我在这里尝试标记一个名为 john 的人,但不幸的是它只生成了纯文本,它没有通知该人,也没有变成与预期相同的设计(参见下面的图像结果) <一href="https://app.slack.com/block-kit-builder/T02HTGREMTJ#%7B%22blocks%22:%5B%7B%22type%22:%22section%22,%22text%22:%7 B%22type%22:%22mrkdwn%22,%22text%22:%22@juan%20%5Cn%5Cnis%20a%20mrkdwn%20section%20block%22%7D%7D,%7B%22type%22:%22imag e%22,%22title%22:%7B%22type%22:%22plain_text%22,%22text%22:%22I%20Need%20a%20Marg%22,%22emoji%22:true%7D,%22image_url% 22:%22https://assets3.thrillist.com/v1/image/1682388/size/tl-horizontal_main.jpg%22,%22alt_text%22:%22marg%22%7D%5D%7D" rel="nofollow noreferrer">查看 Playground
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@juan \n\nis a mrkdwn section block"
}
},
.....
]
}
这是结果
I tried creating slack's block kit builder, the desired design were actually fine. But I don't know where to find a button so we can tag a someone on it.
I have here an attempt to tag a person named john but unfortunately it only generated a plain text, it did not notify the person nor became the same the design as expected (see image result below)
view playground
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@juan \n\nis a mrkdwn section block"
}
},
.....
]
}
Here is the result
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从以下链接找到了解决方案。
https://api.slack.com/reference/surfaces/formatting#mentioning-users
<@userId>
用法:
编辑: 以下是在您不知道的情况下获取用户 ID 的方法:
I found the solution from the following link.
https://api.slack.com/reference/surfaces/formatting#mentioning-users
<@userId>
usage:
EDITED: Here's how to get a userID if you don't know:
接受的答案对我不起作用:用户的名称显示在通知中,但没有显示在消息本身中。
为了解开这个谜团,我使用 Slack Web 客户端发送了一条消息并检查了响应。
消息:
响应:
因此,我们需要围绕用户名拆分消息,并将用户名替换为带有相应用户 ID 的
user
元素类型。The accepted answer does not work for me: the name of the user IS shown in the notification but it's not shown in the message itself.
To solve the mystery, I sent a message using the slack web client and checked the response.
Message:
Response:
So, it turns out we need to split the message around usernames and replace usernames with an element type of
user
with the id of the corresponding user.