Skip to end of banner
Go to start of banner

Integration with Stride and Slack

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Contents

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

Specific SIL integrations

Predefined structures for a Stride message

NameFieldType
JStrideMessageversionnumber
typestring
contentJStrideContent[]
JStrideContenttypestring
textstring
contentJStrideContent[]
marksJStrideMarks[]
attrsJStrideAttrs
JStrideMarkstypestring
attrsJStrideAttrs
JStrideAttrsidstring
localIdstring
statestring
panelTypestring
hrefstring
titlestring
colorstring
typestring
textstring
shortNamestring


Predefined structures for a Slack message

NameFieldType
JSlackMessagechannelstring
textstring
attachmentsJSlackAttachment[]
JSlackAttachmentpretextstring
fallbackstring
titlestring
title_linkstring
textstring
colorstring


Configuring an integration

To do this, you must have Administrator permissions.

General setup

To configure an integration, perform the following actions:

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



  2. Fill in the necessary fields:
    • Name - the name of the integration, it should be unique from other integrations
    • Type - the 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. 

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

Configuring notifications to go from Jira to Stride

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

  1. Go to Stride and select your room.
  2. Open the Apps sidebar, click "+" > Add custom app > API tokens, and specify the app name.



  3. Copy conversation URL and an access token



  4. Insert these to the corresponding fields on the Integration Configurations page.



Now your configuration is ready to be used in a script.

Configuring notifications to go from Jira to Slack

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:

  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.



  4. Copy the access token to the Integration Configurations page and Save.

  5. Now your configuration is ready to be used in a script.

    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:

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);

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

Send a message to Stride when an issue is created

To send a message to Stride when an issue is created, add a post-function on the create transition in Jira with the following code:

JStrideContent reporter;
reporter.type = "text";
reporter.text = key.reporter + "created ";

JStrideAttrs attrs;
attrs.href = getIssueURL(key);
attrs.title = key;

JStrideMarks link;
link.type = "link";
link.attrs = attrs;

JStrideContent issueKey;
issueKey.type = "text";
issueKey.marks = {link};
issueKey.text = key;

JStrideContent summary;
summary.type = "text";
summary.text = " : " + key.summary;

JStrideContent paragraph;
paragraph.type = "paragraph";
paragraph.content = {reporter, issueKey, summary};

JStrideMessage message;
message.version = 1;
message.type = "doc";
message.content = {paragraph};

return sendIntegrationMessage("PS", message);

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

See also

sendIntegrationMessage — Sends a message to integration.

  • No labels