slack-bot-api icon indicating copy to clipboard operation
slack-bot-api copied to clipboard

Mentioned users not notified

Open wadewegner opened this issue 7 years ago • 10 comments

When using postMessageToChannel and @ mentioning someone they aren't receiving a notification.

wadewegner avatar Jul 08 '17 19:07 wadewegner

I've also tried <@wadewegner> in the message, and while that sends me a notification it also doesn't render properly:

image

wadewegner avatar Jul 08 '17 19:07 wadewegner

And if I use <@wadewegner|WadeWegner> I get no notification.

image

wadewegner avatar Jul 08 '17 19:07 wadewegner

Marginal improvement. Passing in link_names: 'true' as params ...

const params = {
  link_names: 'true'
};

... and the following <@wadewegner|Wade Wegner> results in a linked username for me ...

image

... but still isn't formatted correctly.

wadewegner avatar Jul 08 '17 20:07 wadewegner

Also, it's interesting to note that the following two formats work correctly for channel:

<!channel>
<!channel|channel>

image

wadewegner avatar Jul 08 '17 20:07 wadewegner

Okay ... so, looks like turning link_names to true makes the standard @wadewegner work. Huh. That was quite the journey.

wadewegner avatar Jul 08 '17 21:07 wadewegner

Okay, maybe not.

Here's some sample text: const message = 'I found a :neutral_face: [excitement (99.7%)] tweet! (FYI @wadewegner.)';

Now it's not notifying me.

image

wadewegner avatar Jul 08 '17 21:07 wadewegner

If I change the sample text to const message = 'I found a :neutral_face: [excitement (99.7%)] tweet! (FYI @wadewegner .)'; (notice the space after @wadewegner) it works.

wadewegner avatar Jul 08 '17 21:07 wadewegner

Thanks @wadewegner for all debug ;) just what i was looking for ehehhe

digas avatar Nov 04 '17 01:11 digas

@wadewegner does it still work? I used your solution but it isn't working for me

govi218 avatar Nov 30 '17 23:11 govi218

Passing link_names: true worked for me. The bot wasn't able to create links to other channels until I added that like so:

bot.postMessage( event.channel, response, {
    as_user: true,
    link_names: true
} );

codewithtyler avatar Aug 31 '20 20:08 codewithtyler