Events & Signals
JustWorkflowIt workflows can pause and wait for external signals using the WaitForEventIds step executor. This enables approval gates, webhook callbacks, and human-in-the-loop workflows.
How It Works
Section titled “How It Works”- A workflow step uses
/justworkflowit/waitForEventIdswith one or more expected event IDs - The job enters a waiting state (
RUNNINGwith statussuccessful_but_incomplete) - An external system calls
SendJobEventwith the matchingeventId - The engine records the event and advances to the next step
Example: Approval Gate
Section titled “Example: Approval Gate”{ "workflowName": "approval-flow", "steps": [ { "name": "requestApproval", "integrationDetails": { "type": "/justworkflowit/aws/lambda", "config": { "region": "us-east-1", "accountId": "123456789012", "functionName": "send-approval-request" }, "inputDefinition": { "$ref": "#/definitions/workflowInput" }, "outputDefinition": { "$ref": "#/definitions/emptyDef" } }, "transitionToStep": "waitForApproval" }, { "name": "waitForApproval", "integrationDetails": { "type": "/justworkflowit/waitForEventIds", "config": { "eventIds": ["manager-approved"] }, "inputDefinition": { "$ref": "#/definitions/emptyDef" }, "outputDefinition": { "$ref": "#/definitions/approvalResult" } }, "transitionToStep": "deploy" }, { "name": "deploy", "integrationDetails": { "type": "/justworkflowit/aws/lambda", "config": { "region": "us-east-1", "accountId": "123456789012", "functionName": "run-deployment" }, "inputDefinition": { "$ref": "#/definitions/approvalResult" }, "outputDefinition": { "$ref": "#/definitions/emptyDef" } }, "transitionToStep": null } ], "definitions": { "workflowInput": { "type": "object", "properties": { "prId": { "type": "string" } }, "required": ["prId"], "additionalProperties": false }, "emptyDef": { "type": "object", "properties": {}, "required": [], "additionalProperties": false }, "approvalResult": { "type": "object", "properties": { "approved": { "type": "boolean" } }, "required": ["approved"], "additionalProperties": false } }}When the manager approves:
curl -X POST .../jobs/$JOB_ID/events \ -H "Authorization: Bearer $TOKEN" \ -d '{"eventId": "manager-approved"}'Multiple Events
Section titled “Multiple Events”A single WaitForEventIds step can wait for multiple events. The step completes only after all listed event IDs have been received.