Conversational WhatsApp Message File Processes

Prev Next

These file processes only work for Cloud API customers, these features are not available for OnPrem customers (TR numbers).

Uploading a file for your conversational 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. 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.

Note: When you upload a file to Meta, the system generates a file ID. This ID can be used instead of the file URL when sending messages.

  • As of now, the validity period of Meta File Upload IDs has been reduced from 1 month to 1 week.

  • This update only affects file uploads made via API endpoints.

  • Panel usage is not affected, as it doesn’t rely on this file ID system.

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.**************************************' \
--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. 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.**************************************' \
--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"
}