Sending Messages with Attachments

Send a text message with attachments from the business to a customer.


A message can include one or more attachments with a message type of text. An attachment can be an image, PDF, or other file type, and it must be smaller than 100 MB.

Business Chat ensures that each attachment is available to the customer for 30 days. If, within that 30-day period, the Messaging Service Provider (MSP) platform sends a new message that includes a reference to an existing attachment, Business Chat extends the attachment’s availability for another 30 days. If the customer’s device is offline for 30 days or more, the device retrieves only attachments sent in the previous 30 days.

Get the Attachment Reference

An attachment sent by the MSP platform isn't included in the message JSON. Instead, the MSP platform adds a reference to the attachment in the Attachment dictionary.

To get the attachment reference, do the following:

  1. Encrypt the attachment (see Encrypting an Attachment).

  2. Authorize the attachment for upload by calling /preUpload with a GET request, passing in the size of the encrypted file attachment (see Authorizing an Attachment for Upload). This endpoint returns the upload-url and metadata about the attachment.

  3. Upload the encrypted file by sending a POST request to the upload-url, which returns a file checksum for the uploaded file (see Uploading an Attachment).

  4. Use the metadata about the attachment and the file checksum to create an Attachment dictionary, which represents the attachment reference that you include in the message JSON (see Adding Attachment Metadata to a Message).

Repeat these steps for each attachment in the array, as shown in , prior to sending the message.

Figure 1

Steps for adding an attachment to a message

Flow diagram showing the steps for adding an attachment to a message. For each attachment, encrypt and authorize it for upload, then upload the file to Business Chat. Add the file checksum returned by Business Chat, and the attachment metadata to the attachment dictionary.

See Also

Message Attachments

Encrypting an Attachment

Secure the contents of the attachment.

Authorizing an Attachment for Upload

Get the URL needed to upload the file by authorizing the attachment for upload to Business Chat.

object preUploadResponseBody

The JSON dictionary keys contained in the /preUpload body.

Uploading an Attachment

Upload the encrypted file to Business Chat.

Adding Attachment Metadata to a Message

Include an attachment in a text message to a customer.