I am trying to send a message from Google Apps Script to Slack via a Webhook URL that works great, but I can't figure out how to send a highlighted or selected user in that text. For example '@UsernameTest how are you?' is something I want to send to a person or channel, but it doesn't work. I figured out that to highlight the channel i.e. send '@Channel' I just needed to write , but that is not what I want. I tried <@UserID> but it still didn't work. (I Received the UserID by using inspector tool on the web-version of Slack on the user.)
The Slack API docs helped some but still have problems.
Here is the code I'm using, thank you.
var SLACK_URL = 'https://hooks.slack.com/services/...
function sendSlackMessage(text) {
var slackMessage = {
text: "@UsernameTest how are you? and all you guys <@Channel>?"
};
var options = {
method: 'POST',
contentType: 'application/json',
payload: JSON.stringify(slackMessage)
};
UrlFetchApp.fetch(SLACK_URL, options);
}