UpdateInlinePreviewAction
The Chat app previews a link in a message by adding or updating one or more cards. For details, see Preview links in Google Chat messages .
Available for Google Workspace add-ons that extend Google Chat.
const card = CardService . newCardBuilder () . setHeader ( CardService . newCardHeader (). setTitle ( "Unfurl Card!" )) . addSection ( CardService . newCardSection () . addWidget ( CardService . newTextParagraph (). setText ( "url" )) . addWidget ( CardService . newButtonSet () . addButton ( CardService . newTextButton () . setText ( "Open URL!" ) . setOpenLink ( CardService . newOpenLink (). setUrl ( "https://www.google.com" ))))) . build (); const cardWithId = CardService . newCardWithId (). setCardId ( "card_one" ). setCard ( card ); const chatDataAction = AddOnsResponseService . newChatDataActionBuilder () . setUpdateInlinePreviewAction ( AddOnsResponseService . newUpdateInlinePreviewAction () . addCardWithId ( cardWithId )). build ();
Methods
| Method | Return type | Brief description |
|---|---|---|
Update
|
Adds the card for this action. | |
Update
|
Adds the expiration for this action. |
Detailed documentation
addCardWithId(cardWithId)
Adds the card for this action.
const card = CardService . newCardBuilder () . setHeader ( CardService . newCardHeader (). setTitle ( "Unfurl Card!" )) . addSection ( CardService . newCardSection () . addWidget ( CardService . newTextParagraph (). setText ( "url" )) . addWidget ( CardService . newButtonSet () . addButton ( CardService . newTextButton () . setText ( "Open URL!" ) . setOpenLink ( CardService . newOpenLink (). setUrl ( "https://www.google.com" ))))) . build (); const cardWithId = CardService . newCardWithId (). setCardId ( "card_one" ). setCard ( card ); const chatDataAction = AddOnsResponseService . newChatDataActionBuilder () . setUpdateInlinePreviewAction ( AddOnsResponseService . newUpdateInlinePreviewAction () . addCardWithId ( cardWithId )). build ();
Parameters
| Name | Type | Description |
|---|---|---|
card
|
Card
|
The card to be set. |
Return
UpdateInlinePreviewAction
— This object, for chaining.
addExpiration(ttl)
Adds the expiration for this action.
Parameters
| Name | Type | Description |
|---|---|---|
ttl
|
Integer
|
The duration of expiration to be set. |
Return
UpdateInlinePreviewAction
— This object, for chaining.

