def lambda_handler()

in functions/callback_lambda/app.py [0:0]


def lambda_handler(event: dict, _context: dict):
    """Sample Lambda function that notifies back the Step function that invoked it,
    using the Task Token id passed along with its payload

    Parameters
    ----------
    event: dict, required
        Input event to the Lambda function
        Requires a valid task token to be passed as 'token'.

    context: object, required
        Lambda Context runtime methods and attributes

    Returns
    ------
        dict: status of notification
    """
    if event:
        print("New event consumed :  {}.".format(event))
    
        time.sleep(6)

        #print("Sending task heartbeat for task ID {}".format(body['token']))
        #STEP_FUNCTIONS_CLIENT.send_task_heartbeat(taskToken=body["token"])
        is_task_success = random.choice([True, False])

        body = event['body']
        taskToken = event['token']
        id = event['aws_stepfunction_execution_id']
        

        print("Sending task success for task ID  {}".format(taskToken))
        STEP_FUNCTIONS_CLIENT.send_task_success(
            taskToken=taskToken,
            output=json.dumps({"id": id})
        )
        
        return { "status": "notified" }