Un objeto que contiene devoluciones de llamada de métodos.
sendTextQuery
sendTextQuery(textQuery) returns Promise<state>
Envía una consulta de texto a la acción conversacional.
Parámetros
textQuery
string
La consulta que se enviará a la acción conversacional.
state
string
Uno de los siguientes:
READY: La plataforma puede aceptar las solicitudes.
BLOCKED: Hay una consulta en tránsito y la consulta nueva se descartará.
UNKNOWN: No se pudo determinar el estado actual de la consulta.
getHeaderHeightPx
getHeaderHeightPx() returns Promise<height>
Determina la altura del encabezado en la parte superior de una pantalla.
Parámetros
height
number
Es la altura en píxeles.
InteractiveCanvasCallbacks
Estas devoluciones de llamada te permiten responder a la información o las solicitudes
de tu acción conversacional, mientras que los métodos
proporcionan una forma de enviar
información o solicitudes a tu acción conversacional.
onUpdate
onUpdate(data) returns undefined
Se llama cuando se envía un HtmlResponse desde la acción conversacional. Después del
al final de la llamada a función, el TTS comenzará de inmediato.
Parámetros
data
Object
Se actualizaron los datos que envió el webhook.
onTtsMark
onTtsMark(markName) returns undefined
Es la devolución de llamada que se invoca durante la reproducción de TTS.
Marcas especiales que siempre se activan:
START indica el inicio de la TTS.
END indica el final del TTS.
ERROR indica un error de reproducción del TTS.
También puedes definir marcas personalizadas
SSML
y la etiqueta <mark>, como <mark name="custom"/>.
Parámetros
markName
string
Nombre de la marca invocado durante la reproducción de TTS
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003eConditional logic in scenes uses values from intent, scene, session, user, home, device, canvas, and resource objects.\u003c/p\u003e\n"],["\u003cp\u003eSupported operations include logical (&&, ||, !), numerical (+, -, *, /), comparison (==, !=, <, <=, >, >=), and operations on lists and maps.\u003c/p\u003e\n"],["\u003cp\u003eBoolean constants \u003ccode\u003etrue\u003c/code\u003e, \u003ccode\u003efalse\u003c/code\u003e, and \u003ccode\u003e!false\u003c/code\u003e are available, and string operations support double or single quotes, substring checks, concatenation, lexicographical comparison, and size calculation.\u003c/p\u003e\n"],["\u003cp\u003eData model objects like \u003ccode\u003eintent\u003c/code\u003e, \u003ccode\u003esession\u003c/code\u003e, and others provide access to various data points for conditional checks, and these values can also be referenced in static prompts.\u003c/p\u003e\n"]]],[],null,["# InteractiveCanvas (Dialogflow)\n\nThe `interactiveCanvas` object is the interface to your conversational action\nthat is made available within your web app.\n| **Note:** The `interactiveCanvas` object is attached to the `window` object. If you are using a front-end framework to develop your web app, you need to ensure that you have access to `window` to set up the API.\n\nMethods\n-------\n\n### ready\n\n ready(callbacks) returns undefined\n\nCalled by the Interactive Canvas web app once it has loaded to register callbacks.\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------------------------------------|\n| `callbacks` | ` `[InteractiveCanvasCallbacks](#interactivecanvascallbacks)` ` An object that contains method callbacks. |\n\n| **Note:** You must invoke the `ready` API in the web app as soon as the page is loaded. Otherwise, the Action will close.\n\n### sendTextQuery\n\n sendTextQuery(textQuery) returns Promise\u003cstate\u003e\n\nSends a text query to the conversational action.\n\n| Parameters ||\n|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `textQuery` | `string` The query to send to the conversational action. |\n| `state` | `string` One of the following: `READY:` Requests can be accepted by the platform. `BLOCKED:` There is a query in flight and the new query will be dropped. `UNKNOWN:` The current query state couldn't be determined. \u003cbr /\u003e |\n\n| **Caution:** `textQuery` must be 640 characters or less.\n\n### getHeaderHeightPx\n\n getHeaderHeightPx() returns Promise\u003cheight\u003e\n\nDetermines the height of the header at the top of a display.\n\n| Parameters ||\n|----------|--------------------------------|\n| `height` | `number` The height in pixels. |\n\nInteractiveCanvasCallbacks\n--------------------------\n\nThese callbacks provide a way for you to respond to information or requests\nfrom your conversational action while the methods provide a way to send\ninformation or requests to your conversational action.\n\n### onUpdate\n\n onUpdate(data) returns undefined\n\nCalled when an `HtmlResponse` is sent from the conversational action. After\nthe end of the function call, the TTS will start immediately.\n\n| Parameters ||\n|--------|--------------------------------------------|\n| `data` | `Object` Updated data sent by the webhook. |\n\n### onTtsMark\n\n onTtsMark(markName) returns undefined\n\nCallback that is invoked during TTS playback.\n\nSpecial marks that always are triggered:\n\n- `START` indicates the start of the TTS.\n- `END` indicates the end of the TTS.\n- `ERROR` indicates an error playing the TTS.\n\nYou can also define custom marks by using\n[SSML](/assistant/actions/reference/ssml)\nand the `\u003cmark\u003e` tag, like `\u003cmark name=\"custom\"/\u003e`.\n| **Note:** SSML marks are not invoked when the following occurs:\n|\n| - Before TTS begins, the user taps the microphone, or the Interactive Canvas client invokes `sendTextQuery`. The TTS is cancelled and any SSML marks in the TTS are ignored.\n| - During TTS, the user taps the microphone, or the Interactive Canvas client invokes `sendTextQuery`. The TTS is interrupted and any remaining SSML marks in the TTS are ignored.\n\n| Parameters ||\n|------------|-------------------------------------------------|\n| `markName` | `string` Mark name invoked during TTS playback. |"]]