def lambda_handler()

in functions/source/get_records.py [0:0]


def lambda_handler(event, context):
    '''
    :summary: Function calls below mentioned rest API endpoints from RocketCX Enterprise Connector for ServiceNow.
            'api/x_ecsd_amazon_conn/connect_cti_api/record' 

            This API accepts caller's phone number, name and record state as input and returns detils for
            matching records. 
            For more details on API please refer to API documentaiton.
    :input: Caller Phone number, caller name, record state = active from call flow.
    :output: A JSON with record details.
            "active_record_found": 0/1, 
            "customer_name": name of record user.
            "open_record_count": number of open records associated with caller phone number
            "record_type_list": list of returned record types separated by '-----'
            "record_number_list": list of returned record numbers separated by '-----'
            "record_subject_list": list of returned record summary separated by '-----'
            "record_open_date_list": list of returned record opend dates seperated by '-----'
    '''

    url: str = os.environ['SERVICENOW_HOST']
    servicenow_user: str = os.environ['SERVICENOW_USER']
    servicenow_password: str = os.environ['SERVICENOW_PASSWORD']
    customer_phone: str = ''
    customer_name: str = ''
    return_object: dict = {}
    record_found: int = 0
    incident_count: int = 0
    hrcase_count: int = 0
    csmcase_count: int = 0
    record_number_list: str = ""
    record_subject_list: str = ""
    record_type_list: str = ""
    record_open_date_list: str = ""

    customer_phone = event['Details']['Parameters']['Phone']
    customer_name =  event['Details']['Parameters']['Name']

    url_with_extension = url + 'api/x_ecsd_amazon_conn/connect_cti_api/record?' \
                        + f'active=true&contact_number={customer_phone}&caller_name={customer_name}'