def handler()

in lambdas/eventbridge/index.py [0:0]


def handler(event, context):
    # event - Data from EventBridge
    # print(event)

    row = getGeoFenceRecord(event['detail']['GeofenceId'])
    if 'deliveryAgent' in row:
        deviceId = row['deliveryAgent']['device']['id']

        if event['detail']['DeviceId'] == deviceId:
            response = pinpoint.send_messages(
                ApplicationId=pinpoint_application_id,
                MessageRequest={
                    'Addresses': {
                        'string': {
                            'ChannelType': 'SMS',
                            'RawContent': 'string'
                        }
                    },
                    'MessageConfiguration': {            
                        'SMSMessage': {
                            'Body': 'The driver should be arriving soon',
                            'Keyword': 'GeoTrack',
                            'MessageType': 'TRANSACTIONAL'
                        },
                    },
                    'TraceId': 'string'
                }
            )

        print(response)

        return {
            'statusCode': 200,
            'body': json.dumps('Success')
        }
    else:
        return {
            'statusCode': 500,
            'body': json.dumps('Error')
        }