Can you add a comment via API from another user?

We create a ticket on behalf of a customer, but, we’d also like the ability to add a comment on behalf of the customer, or as ourselves.

However, I see no raiseOnBehalfOf or commentOnBehalfOf fields.

Is it possible to add a comment as another user, assuming my authenticated user has enough permissions?

@dave3 yes, via user impersonation (User impersonation for Connect apps).

But to be more prescriptive, here’s a post from last year with an example of how to do it:

1 Like

Is there a mechanism that works via the REST api?

@dave3 - once you have that bearer/access token (follow the impersonation docs), you can make REST API calls from your backend app. Scroll down to the section titled Using an access token in a request in the doc page I posted above. All requests sent using that auth token will be made on behalf of the user.

I don’t think I’m being clear, or, I didn’t quite grok that response.

So, I can create a customer request using this api, and I can provide a raiseOnBehalfOf, and provide an email address: https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-rest-servicedeskapi-request-post

But, our app may want to add a comment that the customer made on our app to jira, and we would want it to come from that same user. How can I do a commentOnBehalfOf for that comment?

Keep in mind, the user may or may not have existed when I created the issue - I pass in an email address to raiseOnBehalfOf, and if the user is not already on service desk, an account will be created for them.

Also, we do not do OAUTH, we use Basic Authentication with a generated token for our admin user. Basic auth for REST APIs

So, I’m not sure how to impersonate using REST and Basic Authentication.

Hi @dave3,

I don’t think it is possible with normal Rest API.
There is an open feature request: [JRACLOUD-35124] Add a comment via REST API on behalf of another user - Create and track feature requests for Atlassian products.
Comment just does not work the same as create.

Cheers,
Andy

Hello. So, as of today, is there any solution to have customers writing comments in their own request on JSM? We would like to have comments written by customers, not by the admin user.

I believe it’s still not possible.

I’m assuming customers refers to “external” users here. Hence you’ll not have access to their user identity in the JIRA instance to be able to perform any actions as them.

But if the user was to somehow exist in the system unless they were part of the same JIRA instance, there’s no way to post anything as that user. If the user was a part of the same JIRA instance, you could try performing actions as the user via Connect or Forge apps as mentioned in the original answer.