Back to results for “AWS Step Functions”
AWS › AWS Step Functions

How can Step Functions be used to orchestrate long running human approval workflows using the callback pattern with task tokens?

Advanced

Answer

The callback pattern lets a Step Functions workflow pause a task and wait for an external system or a human to signal that a specific action has completed, using a unique task token that gets sent alongside a notification, such as an email requesting approval, and the workflow only resumes once that specific token is returned through a SendTaskSuccess or SendTaskFailure API call, making it possible to model workflows that depend on manual human decisions lasting anywhere from minutes to days without wasting compute resources waiting.
aws stepfunctions send-task-success --task-token abc123 --task-output '{"approved": true}'
Real-world example A loan approval workflow pauses at a manual review step, sending an email with a task token embedded in an approval link to a loan officer, and the workflow only resumes and proceeds to the next step once that officer clicks approve, potentially days later.

Common follow-ups: What happens if a task token callback is never received within the configured timeout?;How does the callback pattern differ from simply polling for a status change?