Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 11
Excerpt

Use SIL™ scripts in order to send messages to Slack.

Specific SIL™ integrations

Predefined structures for a Slack message

Name

Field

Type

JSlackMessage

channel

string

text

string

attachments

JSlackAttachment[]

JSlackAttachment

pretext

string

fallback

string

title

string

title_link

string

text

string

color

string

Configuring an integration

Note

To do this, you must have Administrator permissions.

General setup

To configure an integration, perform the following operations:

  1. In your Jira, go to Manage apps > Appfire Anova Apps Plugin Configuration > Integration Configurations, and click Add Integration.

    View file
    nameInvalid file id - UNKNOWN_MEDIA_ID
    pageSIL Template Language

  2. Fill in the necessary fields:

    • Name - Name of the integration, it should be unique from other integrations

    • Type - Integration type 

    • Access token

      View file
      nameInvalid file id - UNKNOWN_MEDIA_ID
      pageSIL Template Language

  3. Save the integration. After saving the added integration, a new entry is added to the table on the Integration Configurations page. 

To edit or remove a configuration, click Edit/Delete.

Info

For security reasons, on the cloud version the token is only visible at the creation moment, not after.

Configuring notifications to go from Jira to Slack

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:

  1. Navigate to the Slack API page.

  2. Click Your Apps > Create New App.

  3. Go to your app and click Add Features and functionality.

    View file
    nameInvalid file id - UNKNOWN_MEDIA_ID
    pageSIL Template Language

  4. Go to Permissions > Scopes and select what this app is going to doClick Save Changes.


  5. 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.

    View file
    nameInvalid file id - UNKNOWN_MEDIA_ID
    pageSIL Template Language

    Optionally, you can Manage distribution for your app and enable other workspaces to install your app using OAuth.

    View file
    nameInvalid file id - UNKNOWN_MEDIA_ID
    pageSIL Template Language

  6. Copy the OAuth Access Token to the Integration Configurations page and Save.

    View file
    nameInvalid file id - UNKNOWN_MEDIA_ID
    pageSIL Template Language

  7. That's it. Your configuration is ready.

Info

You can read more about internal integrations in 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 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);

See also

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "configuration" and space = currentSpace ( )

Contents

Table of Contents