Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you tag people with a slack bot?

I built a bot for slack. It reads the message when a new user joins and I intend for it to post a message welcoming them: "Welcome @user! What are you building!?"

When it posts @user it doesn't seem as though the actual "tag" is working. Do I need to tag their user ID when I tag people with a bot instead of just using @user?

fontebot tried tagging cristopher.bello but the tag didn't work

like image 497
Dave Fontenot Avatar asked Sep 06 '15 03:09

Dave Fontenot


People also ask

How do you tag a channel on Slack?

Use @channel to let everyone in a channel know about timely, relevant information. This will trigger a desktop or mobile notification for all members of the channel, whether their availability is set to active or away.

Does mentioning someone in Slack add them to the channel?

Mention teammates The member(s) will be notified. The member(s) won't be notified, but you'll have the option to invite them to the channel or do nothing. The member(s) won't be notified or allowed to join the conversation.

How do I notify everyone in a Slack thread?

@everyone notifies every person in the #general channel, @channel notifies all members of a channel, and @here notifies only the active members of a channel. These mentions won't notify people when their notifications are paused, or when they're used in threads.


1 Answers

The correct format is <@userID>

You will simply get the user ID from the event (in your screenshot, the channel_join event)

{     "type": "message",     "subtype": "channel_join",     "ts": "1358877458.000011",     "user": "U2147483828",     "text": "<@U2147483828|cal> has joined the channel" } 

Update: (I have not checked the solution proposed in the edit)

In the new Bolt SDK you can tag user by using the brackets around the @NameOfUser. So the example above could also be:

{     "type": "message",     "subtype": "channel_join",     "ts": "1358877458.000011",     "user": "U214####",     "text": "<@NameOfUser> has joined the channel" } 

You would need to parse the @Name out of the message of course.

like image 98
Matthieu Avatar answered Sep 22 '22 14:09

Matthieu