Tired of Manually Updating JIRA Tickets? Let Slack Reactions Do It for You! 🚀
On-call engineers already have enough on their plate—manually updating JIRA ticket statuses shouldn’t be one of them. It’s a tedious, time-consuming task that’s easy to forget, leading to delays and miscommunication.
But what if a simple Slack reaction could handle it for you? In this post, we’ll build an automation that updates JIRA ticket statuses instantly based on Slack emoji reactions—saving time and making life easier!
Fun Fact: Even AI can't generate this solution. Yet! 😎
Architecture
The workflow begins when an end-user creates a JIRA ticket in Slack using the /jira create
command or directly from the console. Automation is triggered based on the emoji reaction to the Slack message, which seamlessly updates the JIRA ticket status.
Prerequisites:
- Need a paid Slack subscription.
- An AWS User/Role with the below permissions:
- AWSLambda_FullAccess
- IAMFullAccess
- Jira Cloud integration with Slack
GitHub
You can find the resources in abhivaidya07/slack-reaction-bot
Steps:
Create a Slack Application
- On the Your Apps page, select Create New App.
- Select From scratch.
- Enter your App Name.
- Select the Workspace where you'll be developing your app. You'll be able to distribute your app to other workspaces later if you choose.
- Click Create App.
Adding Permissions to Slack application
- Go to the Slack application created in the above steps.
- From the left navigation panel, select OAuth & Permissions, scroll down to Scopes.
- Under Bot Token Scopes, select Add an OAuth Scope.
- To allow your app to react based on slack reactions, add below scopes:
channels:history
reactions:read
users:read
-
users:read.email
- Scroll up to OAuth Tokens and click on Install to Workspace button.
- You'll now be sent through the Slack OAuth flow. Select Allow on the following screen.
- Copy and Save the Bot User OAuth Token (starting with
xoxb
), we will need it in the next steps !!
Enable Workflow steps
- From the left navigation panel, select Org Level Apps.
- Click Enable Org-Readiness and enable it.
- Go to Workflow steps in left navigation panel.
- Click on Update settings
- We'll enable Event Subscriptions in further steps.
Create Lambda Function (Using AWS Console)
- Open the Functions page of the Lambda console.
- Choose Create function.
- Select Author from scratch.
- In the Basic information panel, enter the Function name.
- For Runtime, choose Python 3.9.
- Leave architecture set to x86_64.
- Expand Additional Configurations and then select Enable function URL.
- For Auth type, choose NONE.
- Choose Create function.
Create/Attach Lambda Layers
- Install python version 3.9
-
Run the below command to install
jira
package on the local filesystem.
pip3 install jira -t jira/python
-
Repeat the same command to install
requests
package on the local filesystem.
pip3 install requests -t requests/python
-
Create
.zip
files for both the install packages
cd jira && zip -r ../jira_layer.zip python cd .. cd requests && zip -r ../requests_layer.zip python cd ..
-
Create AWS lambda layers using the below commands:
aws lambda publish-layer-version --layer-name jira-layer --zip-file fileb://jira_layer.zip --compatible-runtimes python3.9 --query 'LayerVersionArn' --output text aws lambda publish-layer-version --layer-name requests-layer --zip-file fileb://requests_layer.zip --compatible-runtimes python3.9 --query 'LayerVersionArn' --output text
Copy
LayerVersionArn
from the above commands-
Run the below command to attach layers to the lambda function.
aws lambda update-function-configuration \ --function-name <FUNCTION_NAME> \ --layers <JIRA_LAYER_VERSION_ARN> <REQUEST_LAYER_VERSION_ARN>
Replace the following:- FUNCTION_NAME: Name of the lambda function created in above steps.
- JIRA_LAYER_VERSION_ARN: ARN of the JIRA layer.
- REQUEST_LAYER_VERSION_ARN: ARN of the request layer.
Upload Code to Lambda Function (Using AWS Console)
- Clone this GitHub repository.
-
Zip the repository content using the below commands.
cd slack-reaction-bot zip -r slack_reaction_function.zip . -x ".git/*"
Open the Functions page of the Lambda console.
Choose the function created above and choose the Code tab.
Under Code source, choose Upload from.
Choose .zip file, and then choose Upload.
Select the zip file we created in earlier steps.
Click Deploy.
Set Environment Variables for Lambda Function (Using AWS Console)
- Open the Functions page of the Lambda console.
- Choose the function created above and choose the Configuration tab.
- Select Environment variables, choose Edit.
- Click Add environment variable and add below variables:
- Key: JIRA_SERVER, Value: Your JIRA server URL for eg. https://org-name.atlassian.net
- Key: JIRA_USERNAME, Value: Your JIRA username.
- Key: JIRA_API_TOKEN, Value: API Token for above user. Refer to this link for token creation.
- Key: SLACK_APP_TOKEN, Value: Slack token created in Adding Permissions to Slack application step
- Key: DONE_TRANSITION_ID, Value: Transition ID of done status. for example: 41
- Key: IN_PROGRESS_TRANSITION_ID, Value: Transition ID of in-progress status. for example: 31
- Steps to get transition ID:
- Go to JIRA board > Project settings > Workflows > Edit workflow
- Steps to get transition ID:
- Click Save.
Enable Event Subscriptions
- On the Your Apps page, select application created in above steps.
- From the left navigation panel, select Event Subscriptions and toggle Enable Events to ON.
- Paste the Function URL of our lambda function into Request URL
- Request URL should be Verified.
- (Temporary) Within Subscribe to bot events, select Add Bot User Event, then search for
reaction_added
. - Click Save Changes.
Note: We will remove the
reaction_added
event to ensure we do not receive two events when a slack reaction is added.
Create Workflow Steps
- From the left navigation panel, select Workflow Steps.
- Click
Update settings
from the highlighted text. - Go to Event Subscriptions, remove the
reaction_added
event added in the earlier step and click Save Changes. - Go back to Workflow Steps and click Add Step.
- Provide the Basic Information as shown in the below image:
- Click Input Parameters and fill in the details as follows:
- Input 1:
- Input type: String
- Make required: Enabled
- Parameter ID: message_ts
- Title: Message Timestamp
- Input 2:
- Input type: Channel
- Make required: Enabled
- Parameter ID: channel_id
- Title: Message Channel ID
- Input 3:
- Input type: User
- Make required: Enabled
- Parameter ID: user_id
- Title: Message User ID
- Input 1:
- Click Create.
- Add one more step, while providing Basic Information as shown in the below image:
- Click Input Parameters and fill in the details as follows:
- Input 1:
- Input type: String
- Make Required: Enabled
- Parameter ID: message_ts
- Title: Message Timestamp
- Input 2:
- Input type: Channel
- Make Required: Enabled
- Parameter ID: channel_id
- Title: Message Channel ID
- Input 3:
- Input type: User
- Make Required: Enabled
- Parameter ID: user_id
- Title: Message User ID
- Input 1:
- Click Create.
- Go to Install App from the left navigation bar and then click Reinstall
Now we are ready to create automation based on Slack reactions !!
Add Automation on Slack Channel
- Open the slack channel on which you want to add automation.
- Click on the name of the channel and go to the Integration tab.
- Under Apps, click Add apps and select the slack application created in earlier steps.
- Go back to the Integration tab, then click on Add Automation.
- Now click on + New Workflow and select Build Workflow.
- For event choose When an emoji reaction is used.
- Choose an
emoji
of your choice andchannel
on which you want automation to work. for eg. I'm using emoji as ✅ and channel as#devops
- Click Continue.
- For Steps, scroll down to the last and select Custom.
- Select the Slack application, which we created in earlier steps.
- Select Update Status Done, as this automation is to update the JIRA ticket status as
done
. - Provide inputs for Message Timestamp, Channel ID, and User ID as specified in the image below:
- Click Save, then click on Finish Up
- Provide Name and Description to the automation.
- (Optional) You can also specify who can manage, copy, or find this workflow by clicking on Show more permissions.
- Click Publish.
- Repeat the same steps to create automation for updating the JIRA ticket status as
In Progress
.
Is it working?
- Create a JIRA ticket on Slack using
/jira create
command. - Add a 👀 reaction to the ticket.
- This will trigger our
In-Progress
automation and perform the following steps:- Update the ticket status to In Progress.
- Update the Assignee to the user who reacted.
- If the ticket status is already
In Progress
, then the Lambda function specifies it in CloudWatch logs.
- Now add a ✅ reaction to the ticket.
- This will trigger our
Done
automation and perform the following steps:- Update the ticket status to Done.
- Add a comment on the ticket.
- If the ticket status is already
Done
, then the Lambda function specifies it in CloudWatch logs.
Conclusion
To sum it up, we’ve created a seamless automation that updates JIRA ticket statuses directly through Slack reactions. With the power of a Slack app, AWS Lambda, and Slack workflow steps, this solution not only saves time but also ensures smoother workflows. Plus, it’s highly customizable—you can extend it to handle more reactions, add comments to JIRA tickets based on Slack threads, and much more. The possibilities are endless for optimizing your team's productivity!
Alternatively, you can explore JIRA Service Management, which costs approximately $140 for 4 agents (on-call engineers). However, with this solution, you only pay for the AWS Lambda executions, making it a more cost-effective approach. 🚀
Questions?
If you have any questions, I’ll be happy to read them in the comments.
You can connect with me on LinkedIn.
Top comments (0)