- 05 Apr 2024
- 1 Minute to read
Transactional WhatsApp Message File Processes
- Updated on 05 Apr 2024
- 1 Minute to read
These file processes only work for Cloud API customers, these features are not available for OnPrem customers (TR numbers).
Uploading a file for your transactional WhatsApp messages is a two step process:
File Upload
You can use the Application Uploads endpoint to describe your file and create an upload session.
If successful, a file handle will be returned which you can then use with other endpoints that support file handles returned by the Resumable Upload API.
Headers
Header | Sample Value | Description |
---|---|---|
X-INS-AUTH-KEY | 1a2b3c4d5e6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your token. |
Content-Type | application/json | This header specifies the media type of the resource. |
Example Request
curl --location 'https://whatsapp.useinsider.com/v1/media/upload' \
--header 'x-ins-auth-key: INS.1a2b3c4d5e6f' \
--header 'Content-Type: application/json' \
--form 'file=@"/Desktop/test.jpeg"' \
--form 'type="image/jpeg"' \
--form 'messaging_product="whatsapp"'
Example Response
{
"id": "{{FILE_ID}}"
}
Get File URL
You can use the returned upload session ID to initiate the upload process.
If successful, a file handle will be returned which you can then use with other endpoints that support file handles returned by the Resumable Upload API.
Headers
Header | Sample Value | Description |
---|---|---|
X-INS-AUTH-KEY | 1a2b3c4d5e6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your token. |
Content-Type | application/json | This header specifies the media type of the resource. |
Example Request
curl --location 'https://whatsapp.useinsider.com/v1/media/{{FILE_ID}}' \
--header 'x-ins-auth-key: INS.1a2b3c4d5e6f' \
--header 'Content-Type: application/json'
Example Response
{
"url": "{{FILE_URL}}",
"mime_type": "FILE_TYPE",
"sha256": "{{SHA_CODE}}",
"File_size": {{FILE_SIZE}},
"id": "{{FILE_ID}}",
"messaging_product": "whatsapp"
}