bernspedras
bernspedras

Reputation: 121

How to make a mention to a user in a slack message from Workflow Builder when the username/ID comes from a variable

I'm trying to make a workflow for my slack team where I have these steps (with workflow builder):

I expected the slack message on the channel to have @userHere as a mention (triggering the notifications). However, the message was sent on the channel with @userHere as a plain string i.e. not clickable and it does not trigger a notification.

What I tried:

what I put in the send message step what is saved in the sheet
@variable "user.name"
@variable "U123213"
variable "@user.name"
variable "@U123213"
{{variable}} @user.name

among other attempts, but I never get the mention.

Upvotes: 9

Views: 7136

Answers (3)

diffidentDude
diffidentDude

Reputation: 154

I made a workaround for this. I created a slack list of Names and People, then in the automation use slacks step "Select a list item" to select the correct user from the list.

The list item can then be used as a variable, by which you can access the 'people' part which can be mentioned, added to groups all that sort of thing. It's a bit of a pain cause you have to manage a separate list of names/user pairs but it makes it work as a user in slack which is nice.

enter image description here enter image description here

Upvotes: 2

p8me
p8me

Reputation: 1860

If using webhooks, you can add a "Slack user email" variable in the workflow and then add that variable to the "Message text" with Mention (default) option selected.


Webhook settings

Webhook settings


Send a message settings

Send a message settings

Upvotes: 0

JTega
JTega

Reputation: 17

when posting from the SLACK API I believe the correct code for an @ is to wrap it in angled brackets

<@user_id>

So in the case where you input was of the form

{{variable}}

Then it should translate the variable appropriately.

Upvotes: -3

Related Questions