Detect my forge app has been mentioned in a issue comment

My app in intercepting the event avi:jira:mentioned:comment. As per documentation, this event will be triggered no matter who is getting mentioned in the comments. I need to react only when my app in mentioned, and looking at the event payload I think I should check the key mentionedAccountIds, that contains an array of accounts ID:

mentionedAccountIds: [ '712020:d82d78f5-e9c8-4645-b866-ab0e5d168899' ]

How can I check that one of those Ids corresponds to my app? Is there an API that I can lunch at startup to check the app account id?


Hello @DomingoLupo,

Yes, there is :slight_smile:

To get the Forge app’s accountId on installation, here’s one way that I’ve tried (and worked):

  1. Subscribe to the installation lifecycle event (avi:forge:installed:app)
  2. In the event, get the contextToken; this is a JWT and you need to get the payload
  3. In the payload, the relevant field is called accountId which is the app’s account ID
  4. You can store it in your app e.g., using Storage API, to be used in your comment handler

Do try it out and let us know how it goes.


1 Like