Elsa Workflows / Integrations
Start workflows from a plugin
Another plugin starts Elsa workflows through the plugin's SDK, for the current site, without ever handling the Elsa credentials:
typescript
const elsa = globalThis[Symbol.for("justflows.elsa-workflows.sdk")];
const result = await elsa?.triggerElsaEvent({
eventName: "acme.booking.confirmed",
correlationId: bookingId,
source: "acme.bookings",
input: { bookingId },
});
// { ok: true, instanceIds, correlationId } or { ok: false, error }| Function | What it does |
|---|---|
triggerElsaEvent | Publishes an Elsa event. Every workflow that starts with an Event activity of that name runs. |
dispatchElsaWorkflow | Queues one published definition by id. |
executeElsaWorkflow | Runs one published definition and waits for Elsa to accept the instance. |
After a successful call the plugin emits justflows.elsa-workflows.eventTriggered, .workflowDispatched, or .workflowStarted. They are also webhook event types. The developer guides cover the inputs, results, and errors.