Google Chat V1 API - Class Google::Apps::Card::V1::Card (v0.1.0)

Reference documentation and code samples for the Google Chat V1 API class Google::Apps::Card::V1::Card.

A card interface displayed in a Google Chat message or Google Workspace Add-on.

Cards support a defined layout, interactive UI elements like buttons, and rich media like images. Use cards to present detailed information, gather information from users, and guide users to take a next step.

Card builder

To learn how to build cards, see the following documentation:

Example: Card message for a Google Chat app

Example contact
card

To create the sample card message in Google Chat, use the following JSON:

{ "cardsV2": [ { "cardId": "unique-card-id", "card": { "header": { "title": "Sasha", "subtitle": "Software Engineer", "imageUrl": "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png";, "imageType": "CIRCLE", "imageAltText": "Avatar for Sasha" }, "sections": [ { "header": "Contact Info", "collapsible": true, "uncollapsibleWidgetsCount": 1, "widgets": [ { "decoratedText": { "startIcon": { "knownIcon": "EMAIL" }, "text": &quot;sasha@example.com" } }, { "decoratedText": { "startIcon": { "knownIcon": "PERSON" }, "text": "<font color=&quot;#80e27e&quot;>Online</font>" } }, { "decoratedText": { "startIcon": { "knownIcon": "PHONE" }, "text": "+1 (555) 555-1234" } }, { "buttonList": { "buttons": [ { "text": "Share", "onClick": { "openLink": { "url": "https://example.com/share"; } } }, { "text": "Edit", "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ] } } } ] } } ] } ] } } ] }

Inherits

  • Object

Extended By

  • Google::Protobuf::MessageExts::ClassMethods

Includes

  • Google::Protobuf::MessageExts

Methods

#card_actions

def card_actions() -> ::Array<::Google::Apps::Card::V1::Card::CardAction>
Returns
  • (::Array<::Google::Apps::Card::V1::Card::CardAction>) — The card's actions. Actions are added to the card's toolbar menu.

    Google Workspace Add-ons:

    For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

    "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ]

#card_actions=

def card_actions=(value) -> ::Array<::Google::Apps::Card::V1::Card::CardAction>
Parameter
  • value (::Array<::Google::Apps::Card::V1::Card::CardAction>) — The card's actions. Actions are added to the card's toolbar menu.

    Google Workspace Add-ons:

    For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

    "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ]

Returns
  • (::Array<::Google::Apps::Card::V1::Card::CardAction>) — The card's actions. Actions are added to the card's toolbar menu.

    Google Workspace Add-ons:

    For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

    "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ]

#display_style

def display_style() -> ::Google::Apps::Card::V1::Card::DisplayStyle
Returns

#display_style=

def display_style=(value) -> ::Google::Apps::Card::V1::Card::DisplayStyle
Parameter
Returns
def fixed_footer() -> ::Google::Apps::Card::V1::Card::CardFixedFooter
Returns
def fixed_footer=(value) -> ::Google::Apps::Card::V1::Card::CardFixedFooter
Parameter
Returns

#header

def header() -> ::Google::Apps::Card::V1::Card::CardHeader
Returns

#header=

def header=(value) -> ::Google::Apps::Card::V1::Card::CardHeader
Parameter
Returns

#name

def name() -> ::String
Returns

#name=

def name=(value) -> ::String
Parameter
Returns

#peek_card_header

def peek_card_header() -> ::Google::Apps::Card::V1::Card::CardHeader
Returns

#peek_card_header=

def peek_card_header=(value) -> ::Google::Apps::Card::V1::Card::CardHeader
Parameter
Returns

#section_divider_style

def section_divider_style() -> ::Google::Apps::Card::V1::Card::DividerStyle
Returns

#section_divider_style=

def section_divider_style=(value) -> ::Google::Apps::Card::V1::Card::DividerStyle
Parameter
Returns

#sections

def sections() -> ::Array<::Google::Apps::Card::V1::Card::Section>
Returns

#sections=

def sections=(value) -> ::Array<::Google::Apps::Card::V1::Card::Section>
Parameter
Returns