Designing an example action: Create issue in Jira
Learn how to design an action that creates an issue in Jira.
Step 1: Create an app
- Go to My apps page and add a new app by selecting Start from scratch option.
- Enter a name and a description for your app. You can optionally upload an icon.
Step 2: Connect to Jira
- Go to App settings tab and click Add connection.
- Select Jira as the connection type. Enter a name for your connection.
- You'll be directed to the page where you can update the connection properties.
- Go back and click Connect near Jira connection. Enter your Jira instance's URL, your login email and API key on the opening screen.
Step 3: Create your action
- Go to Actions tab and click Add action.
- Enter a name for your action. You can optionally enter a description, tags and aliases.
Tags are used to manage and filter your actions while aliases can be used as the nicknames for your actions. Your action can be navigated with typing either its name or any of its aliases.
Step 4: Create your inputs
Before starting this step, let's plan our action ahead. Although most Jira issues might require multiple fields, we'll design this action with the most common and required ones.
This action will take 4 inputs: project, issue type, summary and description. Project, issue type and summary will be required inputs, description will be optional.
Add a new input:
project
. Select single select input type and update its label and ID on the right panel. Enable Mandatory option.Add another input:
issueType
. Select single select input type and update its label and ID on the right panel. Enable Mandatory option.Add another input:
summary
. Select text input type and update its label and ID on the right panel. Enable Mandatory option.Add the last input:
description
. Select text input type and update its label and ID on the right panel.
Step 5: Create your requests
We'll start with generating sources for the select components.
Generating sources for project
input through List Projects request
The options of project
input will be the list of projects in your Jira instance. We can get the list of projects from Jira REST API.
Add a new API request. Name it
ListProjects
.Select Jira connection.
Enter
/rest/api/3/project/search
as the endpoint.Run your request.
Navigate to source field of project input on Inputs tab and enter below in display and identifier fields.
Display: {{request.GetProjects.response.body.values.map(p=>p.name)}}
Identifier: {{request.GetProjects.response.body.values.map(p=>p.id)}}
Generating sources for issueType
input through List Issue Types request
The options of issueType
input will be the list of issue types in the selected project. We can get the list of issue types from Jira REST API.
Add a new API request. Name it
ListIssueTypes
.Select Jira connection.
Enter
/rest/api/3/issuetype/project
as the endpoint.Enter a new parameter
projectId
. Enter{{input.project}}
as its valueRun your request.
Navigate to source field of project input on Inputs tab and enter below in display and identifier fields.
Display: {{request.GetIssueTypes.response.body.map(t=>t.name)}}
Identifier: {{request.GetIssueTypes.response.body.map(t=>t.id)}}
API request to create an issue in Jira
Add a new API request. Name it
CreateIssue
.Select Jira connection.
Select POST method.
Enter
/rest/api/3/issue
as the endpoint.Enter below in raw body field.
{
"fields": {
"summary": "{{input.summary}}",
"issuetype": {
"id": "{{input.issueType}}"
},
"project": {
"id": "{{input.project}}"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "{{input.description}}",
"type": "text"
}
]
}
]
}
}
}
Step 6: Run button and run steps
When all requests are ready, next step is to specify which ones will be executed when the action is run.
On Inputs tab, navigate to Run button. Once you select this button, you can change its label and specify the requests that will be executed to run this action.
Change its label to Create.
Add
CreateIssue
request in run steps.
Note that there is no need to add the requests that are used to generate values for inputs. These requests will be triggered when a user calls Actioner app in Slack and navigates to this action. Requests added to run steps are the ones that will be sent when the user clicks run button, such as Create Issue API request while creating a new issue in your Jira project.
Step 7: Create your outputs
In Actioner, outputs are the results of actions. They can be in various visual forms, such as tables, charts, or informational text.
This will generate only one output: a markdown text showing that the issue is created successfully.
On Outputs tab, add a new output. Select Markdown /text option from the list.
On the right panel, enter Result in Title field.
Add a block. Select markdown.
On markdown blocks, you can use markdown styling and dynamically reference to your action's components inside double curlies - {{ }}.
- Enter below on markdown field:
### Issue is created successfully
**Issue key**: {{request.CreateIssue.response.body.key}}
Step 8: Test your action
To test your action, you can use the components on Inputs tab as a form outlay.
Go to Inputs tab and enter values to Project, Issue type, Summary and Description fields.
Click Test action button. It automatically switches to Outputs tab, where you can see the results and continue to work on your action if needed.
Step 9: Apply changes to your action
When your action is ready to be run, you can apply your changes, or revert them and save the action without your progress and delete your draft.
Click Apply changes button at top right corner. This will save the action with all the progress.
Do not forget to enable your action to make it available to be run in Slack.
Step 10: Run your action in Slack
In Slack, type Actioner in shortcuts menu and start typing the name of your action.
Enter parameters on the opening screen.Select a project, the issue type, enter the issue summary and description. When all is set, run your action.
When you run the action, you'll get the result in markdown output format. You can share the result with your colleagues in your preferred channel by adding your notes.