The three steps
1
prepareUpload
Pass You get an
filename, contentType, and the exact size in bytes.upload handle, an uploadUrl, the headers to send, and an expiresAt.2
PUT the bytes
Send the raw file to
uploadUrl with an HTTP PUT, passing the returned headers verbatim. Do not base64-encode. This request goes to storage, not to Concord.3
attachUpload
Pass the You get back the
upload handle from step 1. Add a chatId to attach the file to that conversation, so a following askConcord can work on it.fileId, name, and type of the new Concord file.Constraints
If something fails
- The PUT is refused. Almost always a
sizethat does not match the bytes sent. Recompute the size and start again fromprepareUpload. attachUploadsays the bytes never arrived or differ in size. The PUT failed or was truncated. RunprepareUploadagain and re-upload.attachUploadsays storage could not be reached. The bytes may well be there. CallattachUploadagain rather than re-uploading.attachUploadcalled twice for the same upload returns the same file rather than creating a duplicate.