5

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

enter image description here

tempra
  • 2,455
  • 1
  • 12
  • 27

1 Answers1

10

I found the solution from the following link.

https://api.slack.com/reference/surfaces/formatting#mentioning-users

  1. get the user's id
  2. wrap it with a left and right arrow with an "@" symbol beside it. syntax <@userId>

usage:

{
    "blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "Hey <@802AWTP13BZ>, thanks for submitting your report!"
            }
        }
    ]
}
tempra
  • 2,455
  • 1
  • 12
  • 27
  • 2
    It does not work for me. I have tried several times but fails. Has anyone checked in on current date? – Kukil Kashyap Borgohain May 27 '23 at 12:11
  • Can you add code snippet for the block section to understand the issue better – Minkesh Jain Jul 27 '23 at 08:06
  • I initially thought it wasn't working for me, but as it turns out, **it does work**. I had assumed that the direct message URL contained the user's ID, but you need to retrieve it by visiting their profile, clicking on the three dots, and selecting the 'Copy member ID' option. – Jan Švábík Aug 09 '23 at 13:16