Contents
Table of Contents |
---|
...
In order to send a message to a Slack room, add an integration configuration on the Integration Configurations page. The access token can be a bot, a workspace, or a user token. If you want to create a bot for your workspace, perform the following steps:
- Navigate to the Bots page in the Slack App Directory.
- Click Add Configuration.
- Choose a username for your bot and add the bot integration.
- Copy the access token to the Integration Configurations page and Save.
Now your configuration is ready to be used in a script.
Info You can read more about how to create/regenerate tokens for Slack here.
Examples
Send a message to Slack when
...
a ticket is created
To send a message to Slack when an issue is created, add a post-function on the create transition in Jira with the following code:
Code Block |
---|
JSlackAttachment issue; issue.pretext = key.reporter + " created:"; issue.title = key; issue.title_link =getIssueURL(key); issue.text = key.summary; JSlackMessage message; message.channel = "C94S1U658"; // Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name message.attachments = {issue}; return sendIntegrationMessage("SLACK", message); |
...