A Google Chat message.
Available for Google Workspace add-ons that extend Google Chat.
const card = CardService.newCardBuilder() .setHeader(CardService.newCardHeader().setTitle("Card Title")) .addSection(CardService.newCardSection() .addWidget(CardService.newTextParagraph().setText("Text paragraph"))) .build(); const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card); const message = AddOnsResponseService.newChatMessage().addCardWithId(cardWithId);
Methods
| Method | Return type | Brief description |
|---|---|---|
add | Chat | Sets the card of the message. |
set | Chat | Sets the text of the message. |
Detailed documentation
addCardWithId(cardWithId)
Sets the card of the message.
const card = CardService.newCardBuilder() .setHeader(CardService.newCardHeader().setTitle("Card Title")) .addSection(CardService.newCardSection() .addWidget(CardService.newTextParagraph().setText("Text paragraph"))) .build(); const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card); const message = AddOnsResponseService.newChatMessage().addCardWithId(cardWithId);
Parameters
| Name | Type | Description |
|---|---|---|
card | Card | The cardWithId to set. |
Return
Chat — This object, for chaining.
setText(text)
Sets the text of the message.
const message = AddOnsResponseService.newChatMessage().setText("Example text");
Parameters
| Name | Type | Description |
|---|---|---|
text | String | The text part of a message. |
Return
Chat — This object, for chaining.