Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Contents

Table of Contents

Excerpt

Starting with version 4.0.13 of the Power Scripts™, we 've have added the ability to use SIL™ scripts in order to send a message messages to Stride or and Slack.

Specific SIL™ integrations

...

To configure an integration, perform the following actionsoperations:

  1. In your Jira, go to Manage add-onsapps > cPrime Plugin Configuration > Integration Configurations, and click Add Integration.



  2. Fill in the necessary fields:
    • Name - the name Name of the integration, it should be unique from other integrations
    • Type - the integration Integration type 
    • Access token
    • Conversation URL - you need to specify this for Stride integration only



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

...

In order to send a message to a Stride room, add an integration on to the Integration Configurations page. To generate an access token and a conversation URL you have to:

...

In order to send a message to a Slack room, add an integration configuration on to 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 workspaceusing new Slack apps functionality. It enables to integrate ingenious services by building an app. For an integration to get done you need to retrieve an access token.

To get an access token, perform the following stepsoperations:

  1. Navigate to the Bots page in the Slack App Directory.
  2. Click Add Configuration.
  3. Choose a username for your bot and add the bot integration.
    Image Removed
    Copy the access token to the Integration Configurations page and Save.
    Image RemovedNow your configuration is ready to be used in a scriptSlack API page.
  4. Click Your Apps > Create New App.
  5. Go to your app and click Add Features and functionality.

    Image Added

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

    Image Added

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

    Image Added

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

    Image Added


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

    Image Added


  9. Now, your configuration is ready.


    Info

    You can read more about how to create/regenerate tokens for 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 issueatt1;
issueatt1.pretext = key.reporter + " created: "Optional text that appears above the attachment block";
issueatt1.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 "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 = {issueatt1, att2};
 
 
return sendIntegrationMessage("SLACK", message);

Here's an example of how such notification can look like in Slack.

...


Send a message to Stride when an issue is created

...