How do I access the event object or webhook in a TypeScript CloudCode task?

When triggering a normal CloudCode task, it is very easy to access the webhook and associated data, as described here.

When I create a TypeScript CloudCode task, the same logic doesn’t appear to work directly. How can I access the webhook/event object in a TS CC task?

Give this a spin in your TS CloudCode Task:

export async function run(this: TaskContext, event) {
    console.log('webhook object = ', event.object)
}

Is that what you’re looking for?

Great, thanks. Exactly what I was looking for.

1 Like

Note that your task requires this:

import { TaskContext } from '@journeyapps/cloudcode';

in some cases converting from JS does not add this