def lambda_handler()

in functions/source/get_caller.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/user'

            This API accepts caller's phone number as input and returns details for all users associated
            with phone number from SNOW. 
            For more details on API please refer to API documentaiton.
    :input: Caller Phone number from call flow.
    :output: A JSON with caller details.
            "record_found": 0/1, (1= caller phone number is associated with one or more users in SNOW DB.)
            "customer_name": customer_name, (customer name = none if caller number is associated with none or
                                             multiple users in SNOW DB else returns customer name.)
            "duplicate_contact": 0/1, (1 = caller number is associated with multiple users in SNOW DB)
          
    '''

    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
    duplicate_contact: int = 0

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

    url_with_extension = url + 'api/x_ecsd_amazon_conn/connect_cti_api/' \
                         + f'user?contact_number={customer_phone}'