Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

Workflow.sendEvent()

The .sendEvent() resumes execution when an event is sent.

Usage exampleDirect link to Usage example

run.sendEvent("event-name", { value: "data" });

ParametersDirect link to Parameters

eventName:

string
The name of the event to send

step:

Step
The step to resume after the event is sent

ReturnsDirect link to Returns

workflow:

Workflow
The workflow instance for method chaining

Extended usage exampleDirect link to Extended usage example

import { mastra } from "./mastra";

const run = await mastra.getWorkflow("testWorkflow").createRunAsync();

const result = run.start({
inputData: {
value: "hello",
},
});

setTimeout(() => {
run.sendEvent("event-name", { value: "from event" });
}, 3000);

In this example, avoid using await run.start() directly, as it would block sending the event before the workflow reaches its waiting state.

On this page