Files
You can store files on a lead: a signed quotation, an ID proof, a photo from a site visit.
Your file doesn't pass through the telecrm API. It goes straight to secure storage, in two steps:
- Tell telecrm about the file. Send its name, type and size. telecrm saves it on the lead and gives you a private upload link.
- Upload the file to that link. Send the file with a
PUTrequest within 15 minutes.
There is no step 3. You don't need to confirm the upload afterwards.
Where a file can go
| You want to… | See |
|---|---|
| Add a file straight to the lead's timeline, for example a signed quotation | Upload to a lead |
| Fill the file fields of a custom action on the lead, for example the photo on a site visit | Upload to a custom action |
A file uploaded to a lead shows on its timeline as added by telecrm. Custom actions are the activities your workspace sets up under Settings → Custom Actions. You can fill several of a custom action's file fields in one request, and you get a separate upload link for each.
Example
Adding a quotation to a lead's timeline:
bash
# Step 1: tell telecrm about the file
curl -X POST "https://next.telecrm.in/autoupdate/v2/enterprise/{enterpriseId}/lead/{leadId}/file" \
-H "Authorization: Bearer YOUR_SYNC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"file_name": "quotation.pdf",
"content_type": "application/pdf",
"file_size": 87645,
"note": "Signed quotation"
}'
# telecrm replies with the upload link:
# { "presigned_url": "https://s3.ap-south-1.amazonaws.com/..." }
# Step 2: upload the file to that link
curl -X PUT "PASTE_THE_PRESIGNED_URL_HERE" \
-H "Content-Type: application/pdf" \
--data-binary @quotation.pdfStep 2 has no Authorization header. The upload link carries its own permission, so don't send your telecrm token to it.
Downloading and deleting
Every uploaded file has a path. You'll find it on the timeline entry or custom action the file belongs to. Use it to:
- Download the file. Get a download URL gives you a link that works for 1 hour. Files always download to the device and never open in the browser.
- Delete the file. Delete a file removes it permanently. The timeline entry or custom action it belonged to stays on the lead, but it no longer has a file.
Limits
| Limit | Value |
|---|---|
| Largest file | 25 MB |
| Upload link works for | 15 minutes |
| Download link works for | 1 hour |
File names must end with an extension (such as .pdf or .jpg) and can't contain ? or /.
Blocked file types. Files that can run code or behave like a web page are rejected with a 400 error that names the extension:
| Kind | Extensions |
|---|---|
| Web pages | .html .htm .xhtml .shtml .xht |
| SVG images | .svg .svgz |
| Scripts | .js .mjs .sh .bat .vbs .ps1 |
| Programs and installers | .exe .jar .dll .com .scr .msi |
Good to know
- telecrm saves the file on the lead before you upload it. If step 2 fails or never happens, the lead still shows the file, but it can't be opened. To fix it, upload again to the same link while it still works, or start over from step 1.
- Retrying creates a new upload. Step 1 always gives you a fresh link. On a lead, this adds a second file to the timeline. On a custom action, the new file replaces the old one in that field, unless the field is locked after creation.
- With several files, each upload stands alone. If you upload three files to a custom action and one fails, the other two are still saved. Check each upload.
- Send the exact size.
file_sizemust match the file byte for byte. If it doesn't, storage rejects the upload. - telecrm doesn't look inside your files. The type you send in
content_typeis saved as you gave it. - An upload link can be used more than once until it expires. Uploading again to the same link replaces the file.