Hi friends,
I am writing a python script to send weekly emails in the emails I will be sending a report related to SLAs . It is a custom report. Has anyone tried sending the automatic emails using python.
Priya R
Hey @Priyadarshini R ,
Are you planning to do any transformations or summaries of those SLAs? Meaning, if you're pulling things directly from JSM you can use the following API endpoint: JSM Cloud / REST API / Get sla information
GET /rest/servicedeskapi/request/<issue-key-or-id>/sla
But this will get/pull info directly from a specific work item/ticket. If you need a 'report,' you'd need to aggregate things somewhere. 👀
Alternatively, you could use Jira automation and something like this:
Trigger: Go to Project settings > Automation and create a rule with a Scheduled trigger set to run weekly
Fetch Data: Add a Lookup issues action and enter the JQL query for your SLA report (e.g., fetching tickets that breached their SLA)
Send Email: Add a Send email action. You can format the email body using HTML and smart values like
{{#lookupIssues}}to iterate through the results and build a structured table for your report
A similar concept using a JQL query might work with Python.. but that's the approach I'd maybe use or at least try 🤔
Cheers,
Tobi
I will be using python to do custom calculations. There is one service customer portal where users will be using that portal to raise tickets related to many applications like Jira, Prohance, Company Dashboard. Each team handles each applications. So I need to provide a Report for SLA percentage for each team like Jira Prohance etc etc.
Priya R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Priyadarshini R
Welcome to the Atlassian Community!
One thing to clarify: where is the SLA data for your custom report coming from? If you're using native JSM SLAs, an SLA Marketplace app, or calculating the SLA yourself, the API/data retrieval part will be different.
You can query the required Jira issues using the REST API and authenticate with an API token. For sending the email, you could use your organization's SMTP server or an API such as Microsoft Graph if you're using Microsoft 365.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Gor Greyan
Thanks for your reply is it mandatory to use SMTP server or Microsoft Graph to send emails. I am using JSM SLAs. In python we are using JQL to get the total number of breached tickets and we will caluclate the SLA percentage by some formula. But the point is how to make the python send emails ?
Priya R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, Microsoft Graph specifically is not mandatory. But Python itself isn't a mail server, so it still needs an email service/provider to deliver the message.
Jira REST API → run your JQL → calculate the SLA percentage → build the report → send the email
For the last step, you could use your organization's SMTP server, Microsoft Graph if you're on Microsoft 365, or another email API/service available in your environment.
You can use Python's built-in smtplib if your mail system allows authenticated SMTP, so you don't necessarily need an additional Python package.
Since you're using native JSM SLAs, you can retrieve the Jira/JSM data through the REST APIs and perform your SLA calculations in Python.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.