I'm sending a message to a channel using a webhook.
I'm setting link_names: true but userss are not mentioned.
x in one of the [ ])x in each of the [ ])Filling out the following details about bugs will help us solve your issue sooner.
@slack/client version: 4.2.0
node version: 8.9
OS version(s): OSX and Linux (Alpine)
const {IncomingWebhook} = require('@slack/client');
const webhook = new IncomingWebhook('https://my-webhook-url');
webhook.send({text: 'some content @user1.last', link_names: true}, (err, result) => {
if (err) {
// report error
retrun;
}
// report success
});
The message is sent to the channel and user.last is mentioned.
Message is sent, but the string user1.last is a plain text, not a mention and not clickable.
Thanks for the help!
@royts i just tried to reproduce this issue and was not able to. i had to slightly modify your example because it looked like there's a typo retrun instead of return. also, i added logging to see the result. could you make the same changes and let me know if you're still having a problem?
const { IncomingWebhook } = require('@slack/client');
const webhook = new IncomingWebhook('https://hooks.slack.com/services/XXXXXXXXX');
webhook.send({text: 'some content @ankur', link_names: true}, (err, result) => {
if (err) {
// report error
console.log(err);
return;
}
// report success
console.log(result);
});
another issue to check is if you actually have the right username, because Slack is saying farewell to usernames in favor of localizable and easier to personalize display names. i recommend you reconsider using the link_names option at all. its tied to the now outdated concept of usernames, so especially if this is new code, you should instead try to create mentions from user IDs. if you need help with how to achieve that, let me know!
hi @aoberoi - thanks for your answer.
I tried to use use ID (according to this: https://api.slack.com/changelog/2017-09-the-one-about-usernames#prepare) and it works great.
Thank you for that.