简体   繁体   中英

JIRA Rest API Notifications not Leaving Comments in Ticket

I'm currently using the JIRA Rest API to send a notification to a specified user. The problem is that if the user replies to the notification in the email it doesn't create a comment in the ticket. It just replies to the email of the user I'm logged in as. Anyone know how I can make email replies to my api notifications create JIRA comments? Here is my current code:

import requests

url = "https://jiraserver.atlassian.net/rest/api/2/issue/{issue_key}/notify"

notify_data = {
        "subject": "Duis eu justo eget augue iaculis fermentum.",
        "textBody": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
        "htmlBody": "Lorem ipsum <strong>dolor</strong> sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
        "to": {
            "users": [
                {
                    "name": "JIRA user"}]
        },

    }

requests.post(url,auth=('jira_username','jira_password'), json=notify_data)

PS I am able to create comments in tickets if I reply to email notifications that I receive by manually updating an issue in JIRA (eg changing assignee) but not if I reply to the notification created through the API. Here is the API documentation that I used for notifications: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-notify . Anyone know what I'm missing?

After some experimenting I was able to resolve this issue by putting the Issue key in the subject, and setting up a listener on JIRA (settings cog -> system -> incoming mail -> Set up mail server and handler). This will cause replies to the jira notification to create comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM