Jira Weekly Done Issues to Slack

 import logging
import requests
import os
from datetime import datetime, timedelta
import json
from pprint import pprint
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
import time

logger = logging.getLogger(__name__)

def format_ticket(ticket, jira_domain):
    formatted_ticket = {
        "Ticket ID": ticket['id'],
        "Priority": ticket['fields']['priority']['name'],
        "Assignee": ticket['fields']['assignee']['displayName'] if ticket['fields']['assignee'] else "Unassigned",
        "URL": f"https://{jira_domain}.atlassian.net/browse/{ticket['key']}"
    return formatted_ticket

def get_jira_credentials():
    jira_domain = os.environ['JIRA_DOMAIN']

About this template

This app provides a summary of completed Jira tasks posted to a specific Slack thread every week. It uses the Jira API to download closed tickets from the current week. The query filters for tickets with the status 'Done' and last updated this week. The ticket details, including the ticket URL, are posted to Slack in a single thread. The required environment variables are JIRA_DOMAIN, JIRA_EMAIL, JIRA_API_TOKEN, SLACK_TOKEN, and SLACK_CHANNEL.

Introduction to the Jira Weekly Done Issues to Slack Template

Welcome to the step-by-step guide on how to set up and use the Jira Weekly Done Issues to Slack template. This template is designed to help you automatically post a summary of completed Jira tasks to a specific Slack thread every week. It fetches closed tickets from Jira with the status 'Done' and updated within the current week, then formats and sends the details to a Slack channel of your choice.

To get started with this template, simply click on "Start with this Template" on the Lazy platform.

Setting Environment Secrets

Before you can use this template, you'll need to set up some environment secrets within the Lazy Builder. These secrets are necessary for the app to authenticate with Jira and Slack APIs. Here's what you need to do:

  • Navigate to the Environment Secrets tab within the Lazy Builder.
  • Set the following secrets with the corresponding values from your Jira and Slack accounts:
    • JIRA_DOMAIN: Your Jira domain (e.g., 'yourcompany' if your Jira URL is 'yourcompany.atlassian.net')
    • JIRA_EMAIL: The email address associated with your Jira account
    • JIRA_API_TOKEN: Your Jira API token (You can generate one from your Jira account settings)
    • SLACK_TOKEN: Your Slack API token (You can create one from the Slack API website)
    • SLACK_CHANNEL: The ID of the Slack channel where you want to post updates

External Integrations

To ensure the template works correctly, you'll need to have access to both Jira and Slack. Here are the steps to set up the necessary integrations:

  • Jira: Log in to your Jira account and create an API token. You can find instructions on how to do this in the Atlassian support documentation.
  • Slack: Create a Slack app and generate an API token with permissions to post messages to your desired channel. Slack's API documentation can guide you through this process.

Using the Test Button

Once you have set up the environment secrets, you can use the Test button to deploy the app. The Lazy CLI will prompt you for any required user input. There are no additional user inputs required for this template outside of the environment secrets you've already set.

Using the Interface

After deploying the app using the Test button, the Lazy platform will handle the rest. It will automatically post the weekly Jira updates to the specified Slack channel. You can check the Slack channel to see the messages posted by the app.

If you need to make any adjustments or check the status of the app, you can use the Lazy Builder interface to monitor and manage the app's behavior.

That's it! You've successfully set up the Jira Weekly Done Issues to Slack template. Your Slack channel will now receive weekly updates on Jira tickets that have been marked as 'Done'.

Last published
June 15, 2024

More templates like this

PDF Data Extraction and Excel Transfer

An app for extracting name, phone number, and email data from PDF files and transferring it to Excel.


GPT-4 Exam Generator

This app uses GPT-4 to generate a PDF of a new exam based on an uploaded PDF of a past exam.


Job Search Website

A customisable one-page job search website with a search bar and a search button that displays UI cards of matching jobs. You need to have a (free) account on https://rapidapi.com/ to get the API key required for this to work.

React JS
Jira Weekly Done Issues to Slack