We’ve got the Admin UI routing locked down, but the DATA ENRICHMENT flow crashes when the EVENT BRIDGE pushes the conversation.end payload to the Python Lambda. The LAMBDA TRIGGER fires, yet the Step Functions execution fails because the CONTACT ID isn’t mapping correctly in the JSON body. I’m trying to parse the event details before passing them to the ORCHESTRATOR STATE MACHINE, but the payload structure looks wrong compared to what the Admin UI expects for the OUTBOUND ROUTING. Sometimes the EVENT BRIDGE drops the attributes entirely, which breaks the whole chain. The Step Function returns a 500 error on the START EXECUTION call. The EVENT BRIDGE RULE is set to SYS DEFAULT, but the payload keeps missing the required fields.
def lambda_handler(event, context):
contact_id = event['detail']['contactId']
return {
'stateMachineArn': 'arn:aws:states:us-east-1:123456789:stateMachine:EnrichmentFlow',
'input': json.dumps({'contactId': contact_id})
}