slackslack-block-kit

How do we mention or tag someone in using Slack's Block Kit Builder?


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


Solution

  • 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!"
                }
            }
        ]
    }
    

    EDITED: Here's how to get a userID if you don't know:

    1. Search for the person.
    2. Click their profile picture.
    3. Then, click 'Copy member ID' like in the picture.

    enter image description here