AI-generated Key Takeaways
-
This content describes how to upload a file for use in media or rich card messages on the RBM platform.
-
You can upload a file by providing its URL or binary data, and optionally a thumbnail URL.
-
The RBM platform downloads and processes files for user privacy and security, so avoid submitting a high volume of unique URLs for the same file.
-
The RBM platform caches files for 60 days and provides a unique name to identify the file when sending messages.
-
You can upload a file binary by making an HTTP POST request to the Upload URI and including the binary as the request body.
Uploads a file for use in media or rich card messages.
The agent provides the URL or binary of the file and (optionally) the URL of the corresponding thumbnail file.
Important: For user privacy and security, the RBM platform downloads and processes media and PDF files from the provided URLs before delivering them to the user. This prevents agent tracking by unique URLs. Therefore, do not submit a high volume of unique URLs. The RBM platform does not support this, whether the URLs point to the same or different files. Use the same URL for identical files.
The RBM platform caches the file for 60 days and returns a unique name that you can use to identify the file when sending agent messages.
To upload a file binary, make an HTTP POST request to the Upload URI, omit the fileUrl
field from the JSON request body, and specify the binary as the POST request body. For example, use the --upload-file
cURL flag with the fully qualified file path of the binary file.
HTTP request
- Upload URI, for media upload requests:
POST https://rcsbusinessmessaging.googleapis.com/upload/v1/files
- Metadata URI, for metadata-only requests:
POST https://rcsbusinessmessaging.googleapis.com/v1/files
The URL uses gRPC Transcoding syntax.
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "fileUrl": string, "thumbnailUrl": string, "agentId": string } |
Fields | |
---|---|
fileUrl |
Optional. Publicly available URL of the file. The RBM platform determines the MIME type of the file from the content-type field in the HTTP headers when fetching the file. RBM supports image, audio, video, and pdf. Supported image content types: image/jpeg, image/jpg, image/gif, image/png. Supported audio content types: audio/aac, audio/mp3, audio/mpeg, audio/mpg, audio/mp4, audio/mp4-latm, audio/3gpp, application/ogg, audio/ogg. Supported video content types: video/h263, video/m4v, video/mp4, video/mpeg, video/mpeg4, video/webm. Supported pdf content types: application/pdf. Note: file URL can have 1 redirect. Redirected file URLs must be publicly accessible. Redirects are not supported for file URLs in CreateAgentMessageRequest. |
thumbnailUrl |
Optional. Publicly available URL of the thumbnail corresponding to the file. If this field is not set, then the RBM platform automatically generates a thumbnail from the file. The RBM platform determines the MIME type of the file from the content-type field in the HTTP headers when fetching the file. Supported image content types: image/jpeg, image/jpg, image/gif, image/png. |
agentId |
Required. The agent's unique identifier. |
Response body
A file resource with a unique name that an agent can use to identify the file when sending messages.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{ "name": string } |
Fields | |
---|---|
name |
Server-assigned unique name of the file resource, which an agent can use to identify the file when sending messages. The format is "files/{uid}", where {uid} is a unique ID. |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/rcsbusinessmessaging
For more information, see the OAuth 2.0 Overview.