Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get workspaceId in a webtrigger listener

Dani Asztalos November 17, 2024

Hi,

I would like to call a Bitbucket api (using api.asApp().requestBitbucket() ) from a webtrigger listener. I have to obtain workspaceId and repositoryId to build a route, but I don't know how. If I try to use view.getContext() or useProductContext() I get an error.

What else should I use?

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Wendy G
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 17, 2024

Hi Dani,

The Forge function linked to your web trigger will have web trigger event as well as the invocation context as the input params.

workspaceId is available in the invocation context. In terms of repos, it depends on your use case but you can either pass the repo in as a query parameter to your web trigger URL and retrieve it from event.queryParameters, or perhaps leverage Forge storage.

E.g. 

export const myWebTriggerFn = (event, context) => {
console.log(event.queryParameters);
console.log(context.workspaceId);
}

 

I think the documentation for web trigger module probably needs updating to make this clearer. I'll ping the team responsible to see if they can fix.

 

Cheers

Wendy

TAGS
AUG Leaders

Atlassian Community Events