AI-generated Key Takeaways
- 
          The interactiveCanvasobject in your web app interfaces with your conversational action and is attached to thewindowobject.
- 
          The readymethod must be called as soon as your web app loads to register callbacks and prevent the Action from closing.
- 
          The sendTextQuerymethod allows you to send a text query to the conversational action with a maximum length of 640 characters.
- 
          The getHeaderHeightPxmethod determines the height of the header at the top of the display in pixels.
- 
          InteractiveCanvasCallbackslikeonUpdateandonTtsMarkallow your web app to respond to information or requests from the conversational action.
The interactiveCanvas object is the interface to your conversational action
that is made available within your web app.
Methods
ready
ready(callbacks) returns undefined
Called by the Interactive Canvas web app once it has loaded to register callbacks.
| Parameters | |
|---|---|
| callbacks | 
        InteractiveCanvasCallbacks
      An object that contains method callbacks. | 
sendTextQuery
sendTextQuery(textQuery) returns Promise<state>
Sends a text query to the conversational action.
| Parameters | |
|---|---|
| textQuery | stringThe query to send to the conversational action. | 
| state | stringOne of the following: 
 
 
 | 
getHeaderHeightPx
getHeaderHeightPx() returns Promise<height>
Determines the height of the header at the top of a display.
| Parameters | |
|---|---|
| height | numberThe height in pixels. | 
InteractiveCanvasCallbacks
These callbacks provide a way for you to respond to information or requests from your conversational action while the methods provide a way to send information or requests to your conversational action.
onUpdate
onUpdate(data) returns undefined
Called when an HtmlResponse is sent from the conversational action. After
the end of the function call, the TTS will start immediately.
| Parameters | |
|---|---|
| data | ObjectUpdated data sent by the webhook. | 
onTtsMark
onTtsMark(markName) returns undefined
Callback that is invoked during TTS playback.
Special marks that always are triggered:
- STARTindicates the start of the TTS.
- ENDindicates the end of the TTS.
- ERRORindicates an error playing the TTS.
You can also define custom marks by using
SSML
and the <mark> tag, like <mark name="custom"/>.
| Parameters | |
|---|---|
| markName | stringMark name invoked during TTS playback. | 
