amazon-connect / amazon-connect-salesforce-cti

Documentation for Amazon Connect CTI Adapter for Salesforce.
https://amazon-connect.github.io/amazon-connect-salesforce-cti/
Other
43 stars 37 forks source link

Contact Lens and Transcribe #144

Open shaun0024 opened 2 years ago

shaun0024 commented 2 years ago

I am trying to understand how the CTI adapter integrates with Contact Lens, which I am using.

If I look at the Lambda (sfProcessContactLens) configuration, there is an environment variable called TRANSCRIPTS_DESTINATION that uses the parameter TranscribeOutputS3BucketName. Looking at the description of the parameter it states:

This is the S3 bucket where Amazon Transcribe stores the output. If you don't specify an encryption key, the output of the transcription job is encrypted with the default Amazon S3 key (SSE-S3). Not required if both PostcallRecordingImportEnabled and PostcallTranscribeEnabled set to false.

In my case, I had set both PostcallRecordingImportEnabled and PostcallTranscribeEnabled to false and so left TranscribeOutputS3BucketName as an empty string since I am using Contact Lens.

However, the Lambda sfProcessContactLens code is still trying to refer to an S3 bucket for transcription. Is this a mistake? I'm not sure why Transcribe still needs to be used when Contact Lens has already transcripted the recording.

Invalid bucket name "": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$"
Traceback (most recent call last):
  File "/var/task/sfProcessContactLens.py", line 94, in lambda_handler
    raise e
  File "/var/task/sfProcessContactLens.py", line 69, in lambda_handler
    oMetadata = getS3FileMetadata(os.environ['TRANSCRIPTS_DESTINATION'], contactId)
  File "/var/task/sf_util.py", line 116, in getS3FileMetadata
    response = s3.head_object(Bucket=Bucket, Key='locks/' + ContactId + '.lock')
  File "/opt/python/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/opt/python/lib/python3.7/site-packages/botocore/client.py", line 634, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/opt/python/lib/python3.7/site-packages/botocore/client.py", line 680, in _convert_to_request_dict
    api_params, operation_model, context)
  File "/opt/python/lib/python3.7/site-packages/botocore/client.py", line 712, in _emit_api_params
    params=api_params, model=operation_model, context=context)
  File "/opt/python/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/opt/python/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/opt/python/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/opt/python/lib/python3.7/site-packages/botocore/handlers.py", line 223, in validate_bucket_name
    raise ParamValidationError(report=error_msg)

If I comment the lines 69, 72, 73 and 89 (lines which are trying the read the metadata from a Transcribe object in S3) from the sfProcessContactLens.py file, the code runs successfully and a Contact Lens entry is created in Salesforce.

ramaniad commented 2 years ago

That check is there to validate that if someone has both transcribe and contact lens enabled, it does not create two CCA records in Salesforce. We should add extra logic to skip that line if the TranscribeOutputS3BucketName value is empty though.