new_releases Aggiornamenti: controlla le
note di rilascio per conoscere le nuove funzionalità e gli aggiornamenti del prodotto.
Method: files.create
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Carica un file da utilizzare nei messaggi con contenuti multimediali o schede avanzate.
L'agente fornisce l'URL o il file binario del file e (facoltativo) l'URL del file della miniatura corrispondente.
Importante: per la privacy e la sicurezza degli utenti, la piattaforma RBM scarica ed elabora i file multimediali e PDF dagli URL forniti prima di consegnarli all'utente. In questo modo, viene impedito il monitoraggio degli agenti tramite URL univoci. Pertanto, non inviare un volume elevato di URL univoci. La piattaforma RBM non supporta questa operazione, indipendentemente dal fatto che gli URL rimandino allo stesso file o a file diversi. Utilizza lo stesso URL per file identici.
La piattaforma RBM memorizza nella cache il file per 60 giorni e restituisce un nome univoco che puoi utilizzare per identificare il file quando invii i messaggi dell'agente.
Per caricare un file binario, invia una richiesta POST HTTP all'URI di caricamento, ometti il campo fileUrl
dal corpo della richiesta JSON e specifica il file binario come corpo della richiesta POST. Ad esempio, utilizza il flag cURL --upload-file
con il percorso file completo del file binario.
Richiesta HTTP
- URI di caricamento per le richieste di caricamento di contenuti multimediali:
POST https://rcsbusinessmessaging.googleapis.com/upload/v1/files
- URI dei metadati per le richieste solo di metadati:
POST https://rcsbusinessmessaging.googleapis.com/v1/files
L'URL utilizza la sintassi di transcodifica gRPC.
Corpo della richiesta
Il corpo della richiesta contiene dati con la seguente struttura:
Rappresentazione JSON |
{
"fileUrl": string,
"thumbnailUrl": string,
"agentId": string
} |
Campi |
fileUrl |
string
Facoltativo. URL del file disponibile pubblicamente. La piattaforma RBM determina il tipo MIME del file dal campo content-type nelle intestazioni HTTP durante il recupero del file. RBM supporta immagini, audio, video e PDF. Tipi di contenuti delle immagini supportati: image/jpeg, image/jpg, image/gif, image/png. Tipi di contenuti audio supportati: audio/aac, audio/mp3, audio/mpeg, audio/mpg, audio/mp4, audio/mp4-latm, audio/3gpp, application/ogg, audio/ogg. Tipi di contenuti video supportati: video/h263, video/m4v, video/mp4, video/mpeg, video/mpeg4, video/webm. Tipi di contenuti PDF supportati: application/pdf. Nota: l'URL del file può avere un reindirizzamento. Gli URL dei file reindirizzati devono essere accessibili pubblicamente. I reindirizzamenti non sono supportati per gli URL dei file in CreateAgentMessageRequest.
|
thumbnailUrl |
string
Facoltativo. URL pubblico della miniatura corrispondente al file. Se questo campo non è impostato, la piattaforma RBM genera automaticamente una miniatura dal file. La piattaforma RBM determina il tipo MIME del file dal campo content-type nelle intestazioni HTTP durante il recupero del file. Tipi di contenuti delle immagini supportati: image/jpeg, image/jpg, image/gif, image/png.
|
agentId |
string
Obbligatorio. L'identificatore univoco dell'agente.
|
Corpo della risposta
Una risorsa file con un nome univoco che un agente può utilizzare per identificare il file quando invia messaggi.
In caso di esito positivo, il corpo della risposta contiene dati con la seguente struttura:
Rappresentazione JSON |
{
"name": string
} |
Campi |
name |
string
Nome univoco della risorsa file assegnato dal server, che un agente può utilizzare per identificare il file quando invia messaggi. Il formato è "files/{uid}", dove {uid} è un ID univoco.
|
Ambiti di autorizzazione
Richiede il seguente ambito OAuth:
https://www.googleapis.com/auth/rcsbusinessmessaging
Per ulteriori informazioni, consulta la sezione OAuth 2.0 Overview.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-25 UTC.
[null,null,["Ultimo aggiornamento 2025-07-25 UTC."],[[["\u003cp\u003eThis process allows agents to upload files, including images, audio, video, and PDFs, for use in media or rich card messages, either by providing a public URL or the file's binary data.\u003c/p\u003e\n"],["\u003cp\u003eThe RBM platform handles file privacy and security by downloading and processing media files from provided URLs, preventing agent tracking via unique URLs, and caches the file for 60 days.\u003c/p\u003e\n"],["\u003cp\u003eThe file upload requires an HTTP POST request to either the upload URI \u003ccode\u003ehttps://rcsbusinessmessaging.googleapis.com/upload/v1/files\u003c/code\u003e or the metadata-only URI \u003ccode\u003ehttps://rcsbusinessmessaging.googleapis.com/v1/files\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe agent can provide a public \u003ccode\u003efileUrl\u003c/code\u003e, \u003ccode\u003ethumbnailUrl\u003c/code\u003e, and must include the \u003ccode\u003eagentId\u003c/code\u003e within the request body to upload files.\u003c/p\u003e\n"],["\u003cp\u003eUpon successful upload, the RBM platform returns a unique file name (\u003ccode\u003ename\u003c/code\u003e) that agents can use to reference the file in subsequent messages.\u003c/p\u003e\n"]]],[],null,["# Method: files.create\n\nUploads a file for use in media or rich card messages.\n\nThe agent provides the URL or binary of the file and (optionally) the URL of the corresponding thumbnail file.\n\nImportant: 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.\n\nThe 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.\n\nTo 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.\n\n### HTTP request\n\n- Upload URI, for media upload requests: \n `POST https://rcsbusinessmessaging.googleapis.com/upload/v1/files`\n- Metadata URI, for metadata-only requests: \n `POST https://rcsbusinessmessaging.googleapis.com/v1/files`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------|\n| ``` { \"fileUrl\": string, \"thumbnailUrl\": string, \"agentId\": string } ``` |\n\n| Fields ||\n|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `fileUrl` | `string` 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. |\n| `thumbnailUrl` | `string` 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. |\n| `agentId` | `string` Required. The agent's unique identifier. |\n\n### Response body\n\nA file resource with a unique name that an agent can use to identify the file when sending messages.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|----------------------------|\n| ``` { \"name\": string } ``` |\n\n| Fields ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` 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. |\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/rcsbusinessmessaging`\n\nFor more information, see the [OAuth 2.0 Overview](/identity/protocols/OAuth2)."]]