atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

How to Add a Reply to a Comment Using the Jira API?

Open Dingli16 opened this issue 1 year ago • 3 comments

Hi all,

I plan to use the Jira API to add comments, and I would like to ask how to add a reply to a comment.

Thanks & Regards, Lil

Dingli16 avatar Oct 21 '24 10:10 Dingli16

You can add a new comment to the ticket by using Jira issue_add_comment method def issue_add_comment(self, issue_key, comment, visibility=None): """ Add comment into Jira issue :param issue_key: :param comment: :param visibility: OPTIONAL :return: """ base_url = This will add a new comment to the bottom of the issue comment chain. I don't think you can start a 'thread' like reply to specific existing comment (even from gui)

0x89g09sa823 avatar Oct 21 '24 11:10 0x89g09sa823

As @gkowalc mentioned previously, you cannot directly reply to a comment.

Alternatively we can implement some workaround with links to the comment. Here's a code snippet

jira = Jira(url="https://your_project.atlassian.net/", username="username", password="password")

jira_issue = "MYISSUE-5"
# you can get list of comments using issue_get_comments(jira_issue)
comment_id = 10008 
new_comment_message = f"Answering to [comment #{comment_id}|{jira.url}browse/{jira_issue}?focusedCommentId={comment_id}] ..."

jira.issue_add_comment(jira_issue, new_comment_message)

Resulting comment will look like this

Image

dunterov avatar May 14 '25 21:05 dunterov

@dunterov could you add into examples please ?

gonchik avatar May 15 '25 04:05 gonchik