Upload a file
Upload an attachment for an outgoing message in three steps: get a signed upload URL,
Endpoint
Step 1: Get a signed upload URL
json
See Create an upload URL. The URL is valid for 1 hour.
Step 2: Upload the bytes
Send the same Content-Type you passed as contentType in step 1.
Step 3: Register the file
Body
| Name | Type | Required | Description |
|---|---|---|---|
conversation_id | integer | Yes | Conversation receiving the file. |
file_name | string | Yes | Original file name. |
file_type | string | Yes | MIME type. |
file_size | integer | Yes | Size in bytes. |
file_category | string | Yes | image, audio, video or file. |
s3_key | string | Yes | s3PathWithoutBucket from step 1. |
s3_path | string | Yes | s3Path from step 1. |
organization_id | integer | No | If sent, it must match the conversation's organization. The conversation's organization is always used. |
Request
Response
The conversation file with its _id:
json
For Instagram conversations, images in unsupported formats are converted, and for WhatsApp conversations videos are re-encoded when WhatsApp would reject them; the stored s3_key, file_name and file_type can therefore differ from what you sent. Use the values in the response.
Step 4: Send the message
Pass s3_key, file_name, file_type, file_size and conversation_file_id (the _id) to Send a message with message_type image, video, audio or document. For SMS, send the public URL https://achieveapex-conversation-files.s3.amazonaws.com/<s3_key> in media_urls.
Errors
| Status | When |
|---|---|
400 Bad Request | conversation_id missing or not found, organization_id does not match the conversation, or a required field is missing. |
Report an issue with this documentation
Please log in to report issues with our documentation.