UNABLE TO COPY A COMMENT FROM AN INSTANCE A TO AN INSTANCE B
Asked by Davy Evrard YORO:

Hello

I have two instances in production js.atlassion.net (jira software) for the dev and jsm.atlassian.net (Jira service Management) for the supports.

I have made an app link betwen my two instances. This means that i can link tickets from the two different instances.

What i want to do now, is to be sure that comment made in js tickets copied in jsm tickets.

I saw that the only possible solution for this is to go through automation then rest api. But nothing appens

I share the steps of my config with you

1 - My automation on js

![JS.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/346050iA0977115447FC64B/image-size/large?v=v2&px=999 "JS.PNG")

2 - In send web request, i put this

**Webhook URL\*** **:** <https://jsm.atlassian.net/rest/api/3/issue/{{issue.key}}/comment>

**HTTP Method :** POST

**Webhook body :** Custom data

**Custom data :**

```
"body": { "content": [ { "content": [ { "text": "Commentaire ajout? sur le ticket : {{triggerIssue}}", "text": " Dernier commentaire : {{triggerissue.comments.last.body}}", "type": "text" } ], "type": "paragraph" } ], "type": "doc", "version": 1 }
```

### Headers : Key : Authorization / Value : Basic API_TOKEN (generated in jsm) {#toc-hId--2125356052}


Answers:
author: Jehan Bhathena
body: Hi [@Davy Evrard YORO](/t5/user/viewprofilepage/user-id/5313667) ,

Your automation looks correct.

After the web request is sent, be sure to check the 'Delay Further steps', add a log action step and print the Body and status of the web request sent.

This will help you identify if the comment is being added as expected.

comments: author: Davy Evrard YORO
body: So i add {webhookResponse.status}}

![Sans titre.png](https://community.atlassian.com/t5/image/serverpage/image-id/346267i338F656B18E671E6/image-size/large?v=v2&px=999 "Sans titre.png")

But, I don't see any change in the logs

![de.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/346269iC4CBF34D75A18D66/image-size/large?v=v2&px=999 "de.PNG")


author: Davy Evrard YORO
body: {{#debug}}{webhookResponse.status}}{{/}}


author: Jehan Bhathena
body: Add this syntax {{webResponse.status}} and retry the execution.


author: Davy Evrard YORO
body: Still nothing in the logs. It's weird.


author: Jehan Bhathena
body: Can u share a snapshot of your web request action?


author: Davy Evrard YORO
body: ![WR1.png](https://community.atlassian.com/t5/image/serverpage/image-id/346377i613FA570651CA782/image-size/large?v=v2&px=999 "WR1.png")![WR2.png](https://community.atlassian.com/t5/image/serverpage/image-id/346376i7686E033F46C29D0/image-size/large?v=v2&px=999 "WR2.png")


author: Jehan Bhathena
body: I would suggest making 2 changes

Firstly, check the second box as well so that the flow proceeds even without 200 response, this is for testing sake, and can be unchecked once you're confident the automation works fine.

Next I would Try using the Validate option, with one of the issue keys whose comment you're trying to copy. This will give you instant feedback if something is going wrong.

Just to get better clarity for the audit logs would it be possible to share the output in English please?


author: Davy Evrard YORO
body: Got this error when using the validate option :

```
{  "errorMessages": [    "There was an error parsing JSON. Check that your request body is valid."  ]}
```


author: Davy Evrard YORO
body: My request body

```
{
"body": {
"content": [
{
"content": [
{
"text": "Comment added on ticket {{triggerIssue}}: {{triggerissue.comments.last.body}}",
"type": "text"
}
],
"type": "paragraph"
}
],
"type": "doc",
"version": 1
},
}
```


author: Davy Evrard YORO
body: I solved the last error message by removing the coma here

![WR2.png](https://community.atlassian.com/t5/image/serverpage/image-id/346521i13116A91042CFBD4/image-size/large?v=v2&px=999 "WR2.png")

Now i got an other error message related to permission:

```
{  "errorMessages": [    "Issue does not exist or you do not have permission to see it."  ],  "errors": {}}
```

I thought that the fact of having created the ticket myself gave me the necessary rights. But it seems that to use the api I must have full jira system administrator rights?


author: Jehan Bhathena
body: Hi [@Davy Evrard YORO](/t5/user/viewprofilepage/user-id/5313667)

Use the Jira permission helper with the issue that you're trying to add a comment, that should help you find the root cause for the error.

Also, are you creating a new issue in the same automation? If yes, then you'll need to add the refetch issue data Action to get the new ticket details.


Tags: automation

cloud

jira

jira-service-management

jira-service-management-cloud

rest-api

webhook