Attachments
Downloading files with the key and temporary signed links for outside systems.
An attachment inside a message #
| Field | Type | Req. | Description |
|---|---|---|---|
| id | uuid | yes | file id |
| type | string | yes | image, document, audio, video |
| name | string | no | file name |
| size | int | no | size in bytes |
| mimeType | string | no | content type |
| url | string | no | a signed link with an expiry |
| urlExpiresAt | RFC 3339 | no | when the link stops working |
The signed link #
GET /media/signed/{id}?exp=…&sig=…
The link needs no key: another server opens it, and it has no entrance of ours. The protection is the signature and the one-hour expiry. Conversations must not be served from a guessable address, so open attachment links do not exist.
Download with the key #
GET /api/v1/media/{id} media:read
Serves the file itself with its content type. Useful when the signed link expired or when your server code fetches the file.
curl -s -o act.pdf https://api.widgetchat.ru/api/v1/media/9f2c… -H "Authorization: Bearer wck_…"