Contents
Table of Contents |
---|
...
In order to send a message to a Slack room, add an integration configuration to the Integration Configurations page using new Slack apps functionality. To get an access token, perform the following operations:
- Navigate to the Slack API page.
- Click Your Apps > Create New App.
- Go to your app and click Add Features and functionality.
- Go to Permissions > Scopes and select what this app is going to do. Click Save Changes.
Go to Permissions > OAuth & Permissions. Install your app to the workspace. When you install the app, the tokens are automatically generated. Otherwise, in order to generate your OAuth tokens, request the approval to install this app on your workspace. Click Request Approval to send the request to Slack admins.
Optionally, you can Manage distribution for your app and enable other workspaces to install your app using OAuth.
Copy the OAuth Access Token to the Integration Configurations page and Save.
Now, your That's it. Your configuration is ready.
Info You can read more about internal integrations in Slack here.
...
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 att1; att1.pretext = "Optional text that appears above the attachment block"; att1.title = "This is an example of attachment ..."; att1.text = "*Bold* ~strike~ text"; att1.color = "#4286f4"; JSlackAttachment att2; att2.title = "This is an example of attachment with code."; att2.text = "`var i = 0; doSomethingWith(i);`"; att2.color = "#f45641"; JSlackMessage message; message.channel = "C9S2LC24T"; message.text = "Test slack message with attachment..."; message.attachments = {att1, att2}; return sendIntegrationMessage("SLACK", message); |
...