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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.