Japes Japes - 7 months ago 78
Ruby Question

Slack mentions not working

I'm using the slack-notifier gem to send notifications to my slack channel.

notifier = Slack::Notifier.new "https://hooks.slack.com/services/ABC1234567890"
notifier.ping "Text <@user1>"

That is the general setup in rails.

When I send to @user1 (my coworker), everything is OK.

But if I send it to @user2 (myself), text is displayed without mention creating notification or being a clickable link.

Also, if i send it to a usergroup, @my_team text is same above.

I have also tried
. The output to the slack channel looks like
. So it appears it is not parsing correctly.

Why could this be happening?


(Moving my comment to an answer.)

I'd suggest this:

notifier.ping "Text @user1", parse: "full"

The "full" parse mode means you'll get automatic linking of @username, #channelname, etc., just like you get when typing into the Slack website/clients.