Tutorial: Configure a Slack Template

Follow the steps to configure the Create Jira Cloud issue from Slack using a simple Slack command template and trigger the resulting script.

  1. Click Templates in the left-hand navigation options. 
  2. Click Slack.

    All templates for Slack filter down and appear on the ScriptRunner Connect screen.

  3. Click the Create Jira Cloud issue from Slack using a simple Slack command template. 
    A read-only version of the template appears, which includes overview, setup, and usage details.

  4. Click Create a Workspace.

    The New Workspace dialog appears.

  5. Review and update the Workspace name, Description, and Add to a team details, then click Create.
    A success message appears, and the template workspace opens in the Resource Manager, where you can configure API connections and event listeners before you run the script.

  6. Create and authorize a new Jira Cloud API connector in the workspace.
    1. Click New API Connection for Jira Cloud. 

      The Edit API Connection dialog appears.

    2. In the Uses Connector field dropdown, click Create New.
      The Manage Connector dialog appears.

    3. Enter a name for the connector, then click Authorize.

      A new Atlassian tab opens and prompts you to choose a site (or instance) to authorize and give ScriptRunner Connect proper permissions.

    4. Choose a Jira Cloud site (or instance) to connect to ScriptRunner Connect, then click Accept.
      The Atlassian tab closes, and the Authorize Jira Cloud Site dialog appears in ScriptRunner Connect.

    5. In the Site field dropdown, reselect the intended Jira Cloud site or instance, then click Confirm.

      The Manage Connector screen reappears, and the save option is active.

    6. Click Save to complete the API connector authorization process. 

      The Manage Connector dialog closes.

    7. Click Save on the Edit API Connection dialog to add the newly authorized API connection to the workspace.

      A success message appears.

  7. Configure a Slack API connector in the workspace.
    1. Click New API Connection for Slack.

      The Edit API Connection dialog appears.

    2. In the Uses Connector field dropdown, click Create New.
      The Manage Connector dialog appears.

    3. Enter a name for the Slack API connector, then click Configure.


      The Configure Connector wizard appears.


    4. Complete the wizard steps in ScriptRunner Connect, then click Done to close the wizard.

      The Configure Connector wizard closes, the Manage Connector screen reappears, and the save option is active.

    5. Click Save to complete the API connector authorization process. 

      The Manage Connector dialog closes.

    6. Click Save on the Edit API Connection dialog to add the newly authorized API connection to the workspace.

      A success message appears.

  8. Configure a Slack event listener in the workspace.
    1. Click Slash Command for Slack in the Event Listeners section of the Resource Manager.

      The Edit Event Listener dialog appears.

    2. Ensure the first two fields are as follows:
      1. Listener Event Type is set to Slash Command
      2. UsesExistingScript is set to OnCreateIssueSlackSlashCommand

    3. In the Uses Connector field dropdown, select the Slack connector you created in Step 7, then click Save.


      The Event Listener Setup Instructions for Slack wizard appears.


    4. Complete the wizard steps in ScriptRunner Connect to create a slash command, then click Done to close the wizard.
      The Edit Event Listener dialog reappears in ScriptRunner Connect, and the new slash command is complete.

      ReadMe! 👀
      If you ever find yourself lost in a template-setup process, review the ReadMe information for high-level details on how to succeed.
  9. Click the OnCreateIssueSlackSlashCommand script.


  10. Highlight PROJECT in the JIRA_PROJECT_KEY parameter, and replace it with the project key of the Jira Cloud instance you want the Slack slash command to create new issues within. You can also change the Jira issue type via the ISSUE_TYPE_NAME parameter.


  11. Click Save in the Resource Manager to save the script changes.

  12. Navigate to Slack, and invite the new Slack bot to your desired Slack channel.
    1. In the Slack channel, type @ followed by the name you gave to the Jira Cloud API connector in Step 6c.
    2. Then press Enter.

  13. Test the script by using the new slash command.
    1. In the same Slack channel, type a slash followed by the name of the slash command you defined in Step 8d (wizard Step 4). 
    2. After the slash-command name, type a name for the new Jira Cloud issue you want to create.
      For example: /createissue Test the pay feature
    3. Press Enter.
      The new issue appears in the Jira Cloud project you defined in Step 10.
      The ScriptRunner Connect console log presents the script result. For this tutorial, that includes the newly created Jira Cloud issue key.