Skip to content

create_attached_file async

create_attached_file(
    instance_id: InstanceId,
    file_use_case_type: FileUseCaseType,
    file_source_uri: FileSourceUri,
    associated_resource_arn: ARN,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
) -> CreateAttachedFileResponse

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.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

  • instance_id (InstanceId) –

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • file_use_case_type (FileUseCaseType) –

    The use case for the file.

    Only VOICE_RECORDING is supported.

  • file_source_uri (FileSourceUri) –

    The S3 URI of the file to be attached. Only S3 source URIs are supported.

  • associated_resource_arn (ARN) –

    The ARN of the completed voice contact to attach the file to. Only voice contacts with Telephony subtype are supported.

    This value must be a valid ARN.

  • tags (Optional[TagMap], default: None ) –

    The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def create_attached_file(
    self,
    instance_id: "capo_connect.types.instance_id.InstanceId",
    file_use_case_type: "capo_connect.types.file_use_case_type.FileUseCaseType",
    file_source_uri: "capo_connect.types.file_source_uri.FileSourceUri",
    associated_resource_arn: "capo_connect.types.arn.ARN",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    client_token: Optional["capo_connect.types.client_token.ClientToken"] = None,
    tags: Optional["capo_connect.types.tag_map.TagMap"] = None,
) -> "capo_connect.types.create_attached_file_response.CreateAttachedFileResponse":
    """<p>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.</p> <important> <p>The <code>AssociatedResourceArn</code> must be the ARN of a completed voice contact, <code>FileUseCaseType</code> must be set to <code>VOICE_RECORDING</code>, and <code>FileSourceUri</code> must be a valid S3 URI.</p> </important> <note> <p>For example, you can call <code>CreateContact</code>, then <code>CreateAttachedFile</code>, then <code>StartContactConversationalAnalyticsJob</code> to create a contact, attach a recording, and run post-call analytics.</p> </note>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
        instance_id: <p>The identifier of the Connect Customer instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        file_use_case_type: <p>The use case for the file.</p> <important> <p>Only <code>VOICE_RECORDING</code> is supported.</p> </important>
        file_source_uri: <p>The S3 URI of the file to be attached. Only S3 source URIs are supported.</p>
        associated_resource_arn: <p>The ARN of the completed voice contact to attach the file to. Only voice contacts with Telephony subtype are supported.</p> <note> <p>This value must be a valid ARN.</p> </note>
        tags: <p>The tags used to organize, track, or control access for this resource. For example, <code>{ "Tags": {"key1":"value1", "key2":"value2"} }</code>.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.resource_conflict_exception.ResourceConflictException: <p>A resource already has that name.</p>
        capo_connect.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota has been exceeded.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connect.types.create_attached_file_request.CreateAttachedFileRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.create_attached_file_response.CreateAttachedFileResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.create_attached_file

        (
            output,
            http_response,
        ) = await capo_connect._operations.amazon_connect_service.create_attached_file.async_create_attached_file(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAttachedFile")
    )
    input_: capo_connect.types.create_attached_file_request.CreateAttachedFileRequest = {
        "instance_id": instance_id,
        "file_use_case_type": file_use_case_type,
        "file_source_uri": file_source_uri,
        "associated_resource_arn": associated_resource_arn,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output