Prueba el servidor de MCP para Google Analytics. Instala desde
GitHub y consulta el
anuncio para obtener más detalles.
WebhookNotification
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Configura un recurso de operación de larga duración para enviar una notificación de webhook desde la API de datos de Google Analytics a tu servidor de webhook cuando se actualice el recurso.
Las configuraciones de notificaciones contienen valores privados y solo son visibles para tu proyecto de GCP. Los diferentes proyectos de GCP pueden adjuntar diferentes notificaciones de webhook al mismo recurso de operación de larga duración.
Representación JSON |
{
"uri": string,
"channelToken": string
} |
Campos |
uri |
string
Opcional. Es la dirección web que recibirá la notificación del webhook. Esta dirección recibirá solicitudes POST a medida que cambie el estado del recurso de operación de larga duración. La solicitud POST contendrá una versión JSON del recurso de operación de larga duración en el cuerpo y un campo sentTimestamp . La marca de tiempo enviada especificará los microsegundos de Unix desde la época en que se envió la solicitud. Esto te permite identificar las notificaciones reproducidas. Un ejemplo de URI es https://us-central1-example-project-id.cloudfunctions.net/example-function-1 . El URI debe usar HTTPS y apuntar a un sitio con un certificado SSL válido en el servidor web. El URI debe tener una longitud máxima de cadena de 128 caracteres y usar solo los caracteres de la lista de entidades permitidas de la RFC 1738. Cuando el servidor de tu webhook recibe una notificación, se espera que responda con un código de estado de respuesta HTTP de 200 en un plazo de 5 segundos. Se requiere un URI para usar las notificaciones de webhook. Las solicitudes a este servidor de webhook contendrán un token de ID que autenticará la cuenta de servicio google-analytics-audience-export@system.gserviceaccount.com . Para obtener más información sobre los tokens de ID, consulta https://cloud.google.com/docs/authentication/token-types#id. En el caso de Google Cloud Functions, esto te permite configurar la función para que requiera autenticación. En IAM de Cloud, deberás otorgar los permisos de la cuenta de servicio a los roles de invocador de Cloud Run (roles/run.invoker ) y de invocador de Cloud Functions (roles/cloudfunctions.invoker ) para que la solicitud de publicación del webhook pase la autenticación de Google Cloud Functions. Esta API puede enviar notificaciones de webhook a URIs arbitrarios. En el caso de los servidores de webhook que no son de Google Cloud Functions, se debe ignorar este token de ID en el encabezado del portador de autorización si no es necesario.
|
channelToken |
string
Opcional. El token del canal es un valor de cadena arbitrario y debe tener una longitud máxima de 64 caracteres. Los tokens de canal te permiten verificar la fuente de una notificación de webhook. Esto evita que se falsifique el mensaje. El token del canal se especificará en el encabezado HTTP X-Goog-Channel-Token de la solicitud POST del webhook. No se requiere un token de canal para usar notificaciones de webhook.
|
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003eWebhook notifications can be configured for long-running operations in the Google Analytics Data API to send updates to your server.\u003c/p\u003e\n"],["\u003cp\u003eThese notifications are project-specific and include a JSON payload with operation details and a timestamp.\u003c/p\u003e\n"],["\u003cp\u003eThe webhook configuration requires a URI using HTTPS with a valid SSL certificate, and optionally, a channel token for verification.\u003c/p\u003e\n"],["\u003cp\u003eWhen receiving a notification, your server should respond with an HTTP 200 status code within 5 seconds.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication for Google Cloud Functions is provided through an ID token representing the service account \u003ccode\u003egoogle-analytics-audience-export@system.gserviceaccount.com\u003c/code\u003e, while other webhook servers can ignore this token.\u003c/p\u003e\n"]]],["This document outlines the configuration for webhook notifications from the Google Analytics Data API. You can set up a webhook server (`uri`) to receive POST requests containing long-running operation resource updates in JSON format, along with a `sentTimestamp`. The `uri` must be HTTPS with a valid SSL certificate and is required for webhook notifications. Optionally, use a `channelToken` for source verification, which is included in the `X-Goog-Channel-Token` header. Notifications will include an ID token for authentication.\n"],null,["# WebhookNotification\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\nConfigures a long-running operation resource to send a webhook notification from the Google Analytics Data API to your webhook server when the resource updates.\n\nNotification configurations contain private values \\& are only visible to your GCP project. Different GCP projects may attach different webhook notifications to the same long-running operation resource.\n\n| JSON representation |\n|---------------------------------------------------|\n| ``` { \"uri\": string, \"channelToken\": string } ``` |\n\n| Fields ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `uri` | `string` Optional. The web address that will receive the webhook notification. This address will receive POST requests as the state of the long running operation resource changes. The POST request will contain both a JSON version of the long running operation resource in the body and a `sentTimestamp` field. The sent timestamp will specify the unix microseconds since the epoch that the request was sent; this lets you identify replayed notifications. An example URI is `https://us-central1-example-project-id.cloudfunctions.net/example-function-1`. The URI must use HTTPS and point to a site with a valid SSL certificate on the web server. The URI must have a maximum string length of 128 characters \\& use only the allowlisted characters from [RFC 1738](https://www.rfc-editor.org/rfc/rfc1738). When your webhook server receives a notification, it is expected to reply with an HTTP response status code of 200 within 5 seconds. A URI is required to use webhook notifications. Requests to this webhook server will contain an ID token authenticating the service account `google-analytics-audience-export@system.gserviceaccount.com`. To learn more about ID tokens, see \u003chttps://cloud.google.com/docs/authentication/token-types#id\u003e. For Google Cloud Functions, this lets you configure your function to require authentication. In Cloud IAM, you will need to grant the service account permissions to the Cloud Run Invoker (`roles/run.invoker`) \\& Cloud Functions Invoker (`roles/cloudfunctions.invoker`) roles for the webhook post request to pass Google Cloud Functions authentication. This API can send webhook notifications to arbitrary URIs; for webhook servers other than Google Cloud Functions, this ID token in the authorization bearer header should be ignored if it is not needed. |\n| `channel``Token` | `string` Optional. The channel token is an arbitrary string value and must have a maximum string length of 64 characters. Channel tokens allow you to verify the source of a webhook notification. This guards against the message being spoofed. The channel token will be specified in the `X-Goog-Channel-Token` HTTP header of the webhook POST request. A channel token is not required to use webhook notifications. |"]]