JavaScript / TypeScript Hooks
JavaScript / TypeScript Hooks is one of the supported hooks to receive events.
Last updated
Was this helpful?
JavaScript / TypeScript Hooks is one of the supported hooks to receive events.
Last updated
Was this helpful?
JavaScript / TypeScript Hooks are written as a . The module is executed by .
The module MUST have a of a function taking 1 argument. The argument is the . The function can either be synchronous or asynchronous.
If the Hook is registered for a blocking event, the function MUST return a value according to the .
The Hooks DO NOT have access to file, or environment. They only have access to external network.
The stdout and the stderr of the Hooks are both ignored. Your hooks MUST NOT assume anything on the arguments and the stdin of the module.
In the portal, go to Advanced > Hooks.
Add your Hooks in Blocking Events and Non-Blocking Events, depending on which event you want to listen to.
Click Save.
Here is an example of a Hook for a blocking event.
An example to mutate a JWT token
Here is an example of a Hook for a non-blocking event.
Alternatively, you can edit your hook and use the Deno CLI to typecheck.
is a TypeScript definition that aids you in writing a Hook. You can see the full definition at
If you are a Visual Studio Code user, you can to take full advantage of the definition.