Class CreateMessageAction

CreateMessageAction

A builder for Chat CreateMessageAction objects.

Available for Google Workspace add-ons that extend Google Chat.

constcard=CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle("Card Title"))
.addSection(CardService.newCardSection()
.addWidget(CardService.newTextParagraph().setText("Text paragraph")))
.build();
constcardWithId=CardService.newCardWithId().setCardId("card_one").setCard(card);
constmessage=AddOnsResponseService.newChatMessage().addCardWithId(cardWithId);
constchatDataAction=AddOnsResponseService.newChatDataActionBuilder()
.setCreateChatMessageAction(AddOnsResponseService.newCreateMessageAction()
.setMessage(message))
.build();

Methods

MethodReturn typeBrief description
setMessage(message) CreateMessageAction Sets the message for this action.

Detailed documentation

setMessage(message)

Sets the message for this action.

constcard=CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle("Card Title"))
.addSection(CardService.newCardSection()
.addWidget(CardService.newTextParagraph().setText("Text paragraph")))
.build();
constcardWithId=CardService.newCardWithId().setCardId("card_one").setCard(card);
constmessage=AddOnsResponseService.newChatMessage().addCardWithId(cardWithId);
constchatDataAction=AddOnsResponseService.newChatDataActionBuilder()
.setCreateChatMessageAction(AddOnsResponseService.newCreateMessageAction()
.setMessage(message))
.build();

Parameters

NameTypeDescription
messageChatMessage The chat message to create.

Return

CreateMessageAction — This object, for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年04月13日 UTC.