Loading...
Was this page helpful?
This documentation provides a reference to the createHook
. It belongs to the Workflows SDK.
Expose a hook in your workflow where you can inject custom functionality as a step function.
A handler hook can later be registered to consume the hook and perform custom functionality.
Learn more in this documentation.
1import {2 createStep,3 createHook,4 createWorkflow,5 WorkflowResponse,6} from "@medusajs/framework/workflows-sdk"7import { createProductStep } from "./steps/create-product"8 9export const myWorkflow = createWorkflow(10 "my-workflow",11 function (input) {12 const product = createProductStep(input)13 const productCreatedHook = createHook(14 "productCreated",15 { productId: product.id }16 )17 18 return new WorkflowResponse(product, {19 hooks: [productCreatedHook],20 })21 }22)
Name
stringOptionalTInvokeInput
objectOptionalTInvokeOutput
objectOptionalname
Nameinput
TInvokeInputoptions
objectDefault: {}
Hook
Hook<Name, TInvokeInput, TInvokeOutput>