- Make an API call to get an an upload url and some metadata
- You then upload your file, and metadata to that upload url.
- Use the ID of the attachment you uploaded in other API calls (e.g. create a thread or send an email).
Step by step guide
To try this, you will need an API key with the following permission:attachment:create
1
Creating an upload url
fileName
is the name under which the attachment will appear in the timelinefileSizeBytes
is the exact size of the attachment in bytesc_XXXXXXXXXXXXXXXXXXXXXXXXXX
is the customer id you are uploading the attachment for
2
Uploading the attachment
In the
AttachmentUploadUrl
we created in the previous step we get back 2 fields which are needed to actually upload our attachment:uploadFormUrl
: The URL to which to upload the file touploadFormData
: A list of key, value pairs that have to be included in the data we upload along with the actual file data.
multipart/form-data
) with the data contained in uploadFormData
and submit it to the uploadFormUrl
.Here is some example code showing how you would do this in the Browser and from a Node server:Limitations
- A maximum of 100 attachments can be added to a message
- The combined size of all attachments you add to a message cannot exceed the following limits based on attachment type:
- Email attachments: 6MB
- Chat attachments: 100MB
- Slack attachments: 50MB
- Microsoft Teams attachments: 50MB
- Discord attachments: 50MB
- Thread discussion attachments: 50MB
- Note attachments: 50MB
- The following file extensions are not allowed as attachments:
bat, bin, chm, com, cpl, crt, exe, hlp, hta, inf, ins, isp, jse, lnk, mdb, msc, msi, msp, mst, pcd, pif, reg, scr, sct, shs, vba, vbe, vbs, wsf, wsh, wsl
- Attachments uploaded, but never referenced by a message, will be deleted after 24 hours.
- Upload URLs are only valid for 2 hours after which a new URL needs to be created.