resourceId vs conversation.id | which should I use?


#1

What is the difference between req.body.conversation.id and req.body.resourceId
?

They seem to be the same but are they>

{ 
  key: 'sample-app',  
  productType: 'chat',
  cloudId: 'xxx',
  resourceType: 'conversation',
  resourceId: 'yyy',
  eventType: 'installed',
  userId: 'zzz',
  oauthClientId: 'aaa',
  version: '1' 
}

#2

The response you posted is the body from a /install webhook call. That does specifcy that the resourceType is a conversation in this case. In that webhook the other place you can get a conversation ID is from the JWT token. Since this endpoint doesn’t contain any message component, you would not be able to use req.body.conversation.id to obtain that ID.

In the bot message webhooks, req.body.conversation.id refers to the same resource. All messages belong to a conversation, so all of them will contain which conversation they were in. These calls don’t have the same structure and you would not be able to use req.body.resourceId to determine the conversation ID. The JWT token also contains that information for these webhooks.

You can read more about what a conversation is in our guide here


#3

@JonB the reason behind this is we want to be able to install apps in different atlassian products (Stride, Jira, Confluence) and different contexts (room, site, project, space, etc.). So the more generic model (resourceType, resourceId) is used for app installations.