Skip to main content

attached_files

Creates, updates, deletes, gets or lists an attached_files resource.

Overview

Nameattached_files
TypeResource
Idaws.connect.attached_files

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
associated_resource_arnstringThe resource to which the attached file is (being) uploaded to. The supported resources are Cases, Email, and Task.
created_byobjectInformation on the identity that created the file.
creation_timestringThe time of Creation of the file resource as an ISO timestamp. It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2024-05-03T02:41:28.172Z.
download_url_metadataobjectURL and expiry to be used when downloading the attached file.
file_arnstringThe unique identifier of the attached file resource (ARN).
file_idstringThe unique identifier of the attached file resource.
file_namestringA case-sensitive name of the attached file being uploaded. (pattern: <code>^\P{C}*$</code>)
file_size_in_bytesinteger (int64)The size of the attached file in bytes.
file_statusstringThe current status of the attached file. (APPROVED, REJECTED, PROCESSING, FAILED)
file_use_case_typestringThe use case for the file. (CONTACT_ANALYSIS, EMAIL_MESSAGE, EMAIL_MESSAGE_PLAIN_TEXT, EMAIL_MESSAGE_REDACTED, EMAIL_MESSAGE_PLAIN_TEXT_REDACTED, ATTACHMENT, VOICE_RECORDING)
tagsobjectThe tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_attached_fileselectinstance_id, file_id, associatedResourceArn, regionurlExpiryInSecondsProvides a pre-signed URL for download of an approved attached file. This API also returns metadata about the attached file. It will only return a downloadURL if the status of the attached file is APPROVED.
create_attached_fileinsertinstance_id, associatedResourceArn, region, FileUseCaseType, FileSourceUriCreates an attached file for a completed voice contact by copying a recording from a source S3 URI into Connect Customer managed storage. Use this API to attach voice recordings to contacts for downstream processing such as conversational analytics. The AssociatedResourceArn must be the ARN of a completed voice contact, FileUseCaseType must be set to VOICE_RECORDING, and FileSourceUri must be a valid S3 URI. For example, you can call CreateContact, then CreateAttachedFile, then StartContactConversationalAnalyticsJob to create a contact, attach a recording, and run post-call analytics.
delete_attached_filedeleteinstance_id, file_id, associatedResourceArn, regionDeletes an attached file along with the underlying S3 Object. The attached file is permanently deleted if S3 bucket versioning is not enabled.
start_attached_file_uploadexecinstance_id, associatedResourceArn, region, FileName, FileSizeInBytes, FileUseCaseTypeProvides a pre-signed Amazon S3 URL in response for uploading your content. You may only use this API to upload attachments to a Connect Customer Case, Connect Customer Email, or Connect Customer Task.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
associatedResourceArnstringThe resource to which the attached file is (being) uploaded to. The supported resources are Cases, Email, and Task. This value must be a valid ARN.
file_idstringThe unique identifier of the attached file resource.
instance_idstringThe unique identifier of the Connect Customer instance.
regionstringAWS region (default: us-east-1)
urlExpiryInSecondsintegerOptional override for the expiry of the pre-signed S3 URL in seconds. The default value is 300.

SELECT examples

Provides a pre-signed URL for download of an approved attached file. This API also returns metadata about the attached file. It will only return a downloadURL if the status of the attached file is APPROVED.

SELECT
associated_resource_arn,
created_by,
creation_time,
download_url_metadata,
file_arn,
file_id,
file_name,
file_size_in_bytes,
file_status,
file_use_case_type,
tags
FROM aws.connect.attached_files
WHERE instance_id = '{{ instance_id }}' -- required
AND file_id = '{{ file_id }}' -- required
AND associatedResourceArn = '{{ associatedResourceArn }}' -- required
AND region = '{{ region }}' -- required
AND urlExpiryInSeconds = '{{ urlExpiryInSeconds }}'
;

INSERT examples

Creates an attached file for a completed voice contact by copying a recording from a source S3 URI into Connect Customer managed storage. Use this API to attach voice recordings to contacts for downstream processing such as conversational analytics. The AssociatedResourceArn must be the ARN of a completed voice contact, FileUseCaseType must be set to VOICE_RECORDING, and FileSourceUri must be a valid S3 URI. For example, you can call CreateContact, then CreateAttachedFile, then StartContactConversationalAnalyticsJob to create a contact, attach a recording, and run post-call analytics.

INSERT INTO aws.connect.attached_files (
ClientToken,
FileUseCaseType,
FileSourceUri,
Tags,
instance_id,
associatedResourceArn,
region
)
SELECT
'{{ ClientToken }}',
'{{ FileUseCaseType }}' /* required */,
'{{ FileSourceUri }}' /* required */,
'{{ Tags }}',
'{{ instance_id }}',
'{{ associatedResourceArn }}',
'{{ region }}'
RETURNING
creation_time,
file_arn,
file_id,
file_status
;

DELETE examples

Deletes an attached file along with the underlying S3 Object. The attached file is permanently deleted if S3 bucket versioning is not enabled.

DELETE FROM aws.connect.attached_files
WHERE instance_id = '{{ instance_id }}' --required
AND file_id = '{{ file_id }}' --required
AND associatedResourceArn = '{{ associatedResourceArn }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Provides a pre-signed Amazon S3 URL in response for uploading your content. You may only use this API to upload attachments to a Connect Customer Case, Connect Customer Email, or Connect Customer Task.

EXEC aws.connect.attached_files.start_attached_file_upload
@instance_id='{{ instance_id }}' --required,
@associatedResourceArn='{{ associatedResourceArn }}' --required,
@region='{{ region }}' --required
@@json=
'{
"ClientToken": "{{ ClientToken }}",
"FileName": "{{ FileName }}",
"FileSizeInBytes": {{ FileSizeInBytes }},
"UrlExpiryInSeconds": {{ UrlExpiryInSeconds }},
"FileUseCaseType": "{{ FileUseCaseType }}",
"CreatedBy": "{{ CreatedBy }}",
"Tags": "{{ Tags }}"
}'
;