Enable attachments to share files using chat - Amazon Connect

Enable attachments to share files using chat

You can allow customers and agents to share files using chat. After you complete the steps in this topic, an attachment icon automatically appears in your agent's Contact Control Panel so they can share attachments on chats.

You will need to update your customer-facing user interface to support attachment sharing.

Using a custom agent application? Check out the APIs we've added to support attachment sharing: StartAttachmentUpload, CompleteAttachmentUpload, and GetAttachment.

Step 1: Enable attachments

  1. Open the Amazon Connect console at https://console.aws.amazon.com/connect/.

  2. On the instances page, choose the instance alias. The instance alias is also your instance name, which appears in your Amazon Connect URL.

  3. Choose Data storage.

  4. On the Data storage page, under the Attachments, choose Edit, select Enable Attachments sharing, and then choose Save.

    Storage options appear, similar to the following image.

  5. You can change the Amazon S3 bucket location where attachments are stored. By default, your existing Amazon Connect bucket is used, with a new prefix for attachments.

    The attachments feature leverages two Amazon S3 locations: a staging location and a final location.

    Note the following about the staging location:

    • The staging location is used as part of a business validation flow. Amazon Connect uses it to validate the file size and type before it is shared with the chat participant.

    • The staging prefix is created by Amazon Connect based on the bucket path you have selected. Specifically, it includes the S3 prefix for where you are saving files, with staging appended to it.

    • We recommend that you change the data retention policy for the staging prefix to one day. This way you won't be charged for storing the staging files. For instructions, see How do I create a lifecycle rule for an S3 bucket? in the Amazon S3 User Guide.

      Warning

      Only change the lifecycle for the file staging location. If you accidentally change the lifecycle for the entire Amazon S3 bucket, all transcripts and attachments will be deleted.

Step 2: Configure a CORS policy on your attachments bucket

To allow customers and agents to upload and download files, update your cross-origin resource sharing (CORS) policy to allow PUT and GET requests for the Amazon S3 bucket you are using for attachments. This is more secure than enabling public read/write on your Amazon S3 bucket, which we don't recommend.

To configure CORS on the attachments bucket

  1. Find the name of the Amazon S3 bucket for storing attachments: In the Amazon Connect console, choose Data storage, and locate the Amazon S3 bucket name.

  2. In the Amazon S3 console, select your Amazon S3 bucket.

  3. Choose the Permissions tab, and then scroll down to the Cross-origin resource sharing (CORS) section.

  4. Add a CORS policy that has one of the following rules on your attachments bucket. For example CORS policies, see Cross-origin resource sharing: Use-case scenarios in the Amazon S3 Developer Guide.

    • Option 1: List the endpoints from where attachments will be sent and received, such as the name of your business web site. This rule allows cross-origin PUT and GET requests from your website (for example, http://www.example1.com).

      Your CORS policy might look like the following example:

      [ { "AllowedMethods": [ "PUT", "GET" ], "AllowedOrigins": [ "http://www.example1.com", //List the endpoints from where attachments will be sent and received, "http://www.example2.com" //such as the name of your business web site. ], "AllowedHeaders": [ "*" ] } ]
    • Option 2: Add the * wildcard to AllowedOrigin. This rule allows cross-origin PUT and GET requests from all origins, so you don't have to list your endpoints.

      Your CORS policy might look like the following example:

      [ { "AllowedMethods": [ "PUT", "GET" ], "AllowedOrigins": [ "*" ], "AllowedHeaders": [ "*" ] } ]

Step 3: Update your chat UI

To help you update the chat user interface that your customers use, we've posted an updated version of chat interface JS. It exposes an attachment icon on the UI and supports the backend calls for attachment sharing. See Amazon Connect Chat UI Examples on GitHub.