I’ll introduce JavaScript sample code to mention User Group via Slack API.
For paid account there is an additional command for User Groups that follows the format <!subteam^ID|handle>. (subteam is literal text. ID and handle are replaced with the details of the group.) These indicate a User Group message, and should cause a notification to be displayed by the client. User Group IDs can be determined from the usergroups.list API endpoint. For example, if you have a User Group named happy-peeps with ID of S012345, then you would use the command <!subteam^S012345|happy-peeps> to mention that user group in a message.
- Source: Basic message formatting | Slack
So, if you want to mention the User Group @happy-peeps, write it as <!subteam^S012345|happy-peeps> and it will work correctly.
The following is JavaScript sample code to mention User Group via Slack API:
var userGroup = ' ';
var slackMessage = userGroup + 'こんにちはこんにちは';
UrlFetchApp.fetch(
'https://slack.com/api/chat.postMessage',
{
method: 'post',
payload : {
token: PropertiesService.getScriptProperties().getProperties().SLACK_TOKEN,
channel: '#dev',
username: 'bot',
icon_emoji: ':robot_face:',
text: slackMessage
}
}
);
I’m introducing partially modified code that was written for Google Apps Script.
That’s all from the Gemba where I want to mention User Group via Slack API as well.