Class ChatResponse
ChatRisposta
L'oggetto di risposta per un messaggio con scheda in Google Chat.
Disponibile solo per le app Google Chat. Non disponibile per i componenti aggiuntivi di Google Workspace.
// Creates a card message in Chat.
const cardHeader = CardService.newCardHeader()
.setTitle('Card Header Title')
.setSubtitle('Card Header Subtitle');
const card = CardService.newCardBuilder().setHeader(cardHeader).build();
const chatResponse =
CardService.newChatResponseBuilder()
.setText('Example text')
.addCardsV2(
CardService.newCardWithId().setCardId('card_id').setCard(card))
.build();
console.log(chatResponse.printJson());
Metodi
Metodo | Tipo restituito | Breve descrizione |
printJson() | String | Stampa la rappresentazione JSON di questo oggetto. |
Documentazione dettagliata
printJson()
Stampa la rappresentazione JSON di questo oggetto. Questo è solo per il debug.
Invio
String
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-01-30 UTC.
[null,null,["Ultimo aggiornamento 2025-01-30 UTC."],[[["`ChatResponse` is an object used for card messages specifically within Google Chat apps, not add-ons."],["It facilitates building responses containing text and cards with customizable headers and content using methods like `addCardsV2()`."],["Developers can utilize the `printJson()` method to debug and view the JSON structure of the constructed response for verification."]]],["The `ChatResponse` object, exclusive to Google Chat apps, facilitates the creation of card messages. It is not for Google Workspace add-ons. You can build card messages using methods like `newCardHeader()` and `newCardBuilder()`. `newChatResponseBuilder()` builds the ChatResponse by adding text and cards. `printJson()` outputs the JSON representation of the constructed `ChatResponse` object, for debugging purposes.\n"]]