Contact card block
A person's name and avatar, resolved from a Slack user id.
contact_card shows the name for a Slack user id, resolved the same way a mention is. It doesn’t
appear in the public @slack/types package, so treat this page’s field list as the reference.
Fields
typestring
Always contact_card.
stringcontact_user_id?string
A Slack user id to resolve to a name, the same way <@U0ADA> resolves inside mrkdwn.
stringExamples
Resolved user
The preview above resolves U0ADA to Ada Lovelace using the preview’s sample directory. In your own
app, wire up a resolver backed by the Slack Web API so real user ids
resolve to real names. The lookups run on your server, through a resolver relay or before the page
renders, so the bot token never reaches the browser: see
Keep the bot token on the server.
Workspace name
Under the name, Slack shows the contact’s workspace. Pass it as identity.teamName on
BlockKitProvider; without it the card says “Contact”.
<BlockKitProvider identity={{ teamName: "Acme" }} resolvers={resolvers}>
Unknown user
When resolvers.user is given and doesn’t know the id, the user doesn’t exist as far as the card
can tell, so it shows “This content could not be displayed.”, as Slack does for a user that doesn’t
exist. With no resolvers.user at all, the lookup counts as pending, and the card shows the
placeholder skeleton Slack shows while it looks the user up.