Moose workflows can be triggered programmatically from various sources including APIs, events, external systems, or manual execution. This enables you to build reactive data processing pipelines and on-demand task execution.
The simplest way to trigger a workflow is using the Moose CLI:
# Run a workflow manually
moose workflow run example
# Run with input parameters
moose workflow run example --input '{"name": "John", "email": "john@example.com"}'When triggering workflows, you can pass input data that will be passed to the starting task:
moose workflow run data-processing --input '{
"sourceUrl": "https://api.example.com/data",
"apiKey": "your-api-key",
"batchSize": 100
}'The input is parsed as JSON and passed to the workflow's starting task.
Trigger workflows directly via an HTTP POST endpoint exposed by the webserver.
/workflows/{workflowName}/triggerExample:
curl -X POST 'http://localhost:4000/workflows/data-processing/trigger' \
-H 'Content-Type: application/json' \
-d '{
"inputValue": "process-user-data",
"priority": "high"
}'moose generate hash-token
# Outputs:
# - ENV API Key (hashed) → for environment/config
# - Bearer Token (plain) → for Authorization headerMOOSE_CONSUMPTION_API_KEY="<hashed_key_from_output>"curl -X POST 'https://your-host/workflows/data-processing/trigger' \
-H 'Authorization: Bearer <plain_token_from_output>' \
-H 'Content-Type: application/json' \
-d '{"inputValue":"process-user-data"}'For details, see the API Auth page under "Token Generation" and "API Endpoints".
{ "workflowId": "data-processing-<hash>", "runId": "<id>",}In local development, the response also includes a dashboardUrl to Temporal UI:
{ "workflowId": "data-processing-<hash>", "runId": "<id>", "dashboardUrl": "http://localhost:8080/namespaces/<namespace>/workflows/data-processing-<hash>/<runId>/history"}After triggering a workflow, you can terminate it via an HTTP endpoint.
POST /workflows/{workflowId}/terminatecurl -X POST 'http://localhost:4000/workflows/data-processing-<hash>/terminate'curl -X POST 'https://your-host/workflows/data-processing-<hash>/terminate' \
-H 'Authorization: Bearer <plain_token_from_output>'