JustFlows

Elsa Workflows · Integrate

Events and webhooks

The hooks and webhook events after each start, and how comments and Forms start workflows.

Hooks

After a successful start, Elsa Workflows emits one plugin hook:

EventAfter
justflows.elsa-workflows.eventTriggeredtriggerElsaEvent
justflows.elsa-workflows.workflowDispatcheddispatchElsaWorkflow, including comment workflows
justflows.elsa-workflows.workflowStartedexecuteElsaWorkflow
typescript
ctx.hooks.action("justflows.elsa-workflows.workflowDispatched", async (event) => {
  // { source, correlationId, instanceIds, definitionId, eventName }
  if (event.source === "acme.bookings") await markQueued(event.correlationId);
});

The payload never includes the workflow input, which can hold visitor data. Starts from the admin’s Workflows page are recorded in the audit log and do not emit a hook.

Webhooks

The same three names are added to the site’s webhook event types, so another system can be told about every start with a signed request.

Comments

Elsa Workflows listens to core’s comments.created action. When a comment on an entry with a comment workflow is stored as pending or approved, it dispatches that workflow with source set to comments, the comment id as the correlation id, and this input:

json
{ "contentId": "…", "commentId": "…", "parentId": "", "status": "pending" }

Forms

Forms uses the SDK when a form is stored. With no workflow chosen on the form it triggers the Elsa event justflows.forms.submitted; otherwise it dispatches the chosen workflow. The source is justflows.forms, the submission id is the correlation id, and the input is:

json
{ "formId": "…", "formName": "Contact", "values": { "email": "sam@example.com", "message": "…" } }

Shop

Shop does not start workflows yet. Listen for Shop’s events in your own plugin and call the SDK, or point a Shop webhook at an Elsa HTTP endpoint.