def lambda_handler()

in CBHelper-scheduleCall/lambda_function.py [0:0]


def lambda_handler(event, context):
    print(event)
    CONTACT_TABLE= os.environ['CONTACTS_TABLE']
    
    wakeTime = str(event['Details']['ContactData']['Attributes']['wakeTime'])
    contactId = str(event['Details']['ContactData']['ContactId'])
    contactPhone = str(event['Details']['ContactData']['CustomerEndpoint']['Address'])
    timezone = str(event['Details']['ContactData']['Attributes']['timezone'])
    
    if(wakeTime == "None"):
        wakeTimeFormat = get_time(timezone)
    else:
        wakeTimeFormat = get_custom_time(wakeTime,timezone)
        
    response = add_to_queue(contactPhone, wakeTimeFormat, contactId, CONTACT_TABLE)
    
    return {
        'statusCode': 200,
        'body': json.dumps(response)
    }