Class CardService

Card Service

Card Service provides the ability to create generic cards used across different Google extensibility products, such as Google Workspace add-ons .

Below is a sample for an add-ons card.

 function 
  
 createCard 
 () 
  
 { 
  
 return 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'CardTitle' 
 )) 
  
 . 
 build 
 (); 
 } 

Or you can return multiple Cards like so:

 function 
  
 createCards 
 () 
  
 { 
  
 return 
  
 [ 
  
 CardService 
 . 
 newCardBuilder 
 (). 
 build 
 (), 
  
 CardService 
 . 
 newCardBuilder 
 (). 
 build 
 (), 
  
 CardService 
 . 
 newCardBuilder 
 (). 
 build 
 (), 
  
 ]; 
 } 

The following shows how you could define a card with a header, text, an image and a menu item:

 function 
  
 createWidgetDemoCard 
 () 
  
 { 
  
 return 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
  
 CardService 
 . 
 newCardHeader 
 () 
  
 . 
 setTitle 
 ( 
 'Widget demonstration' 
 ) 
  
 . 
 setSubtitle 
 ( 
 'Check out these widgets' 
 ) 
  
 . 
 setImageStyle 
 ( 
 CardService 
 . 
 ImageStyle 
 . 
 SQUARE 
 ) 
  
 . 
 setImageUrl 
 ( 
 'https://www.example.com/images/headerImage.png' 
 ), 
  
 ) 
  
 . 
 addSection 
 ( 
  
 CardService 
 . 
 newCardSection 
 () 
  
 . 
 setHeader 
 ( 
 'Simple widgets' 
 ) 
  
 // optional 
  
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
  
 'These widgets are display-only. ' 
  
 + 
  
 'A text paragraph can have multiple lines and ' 
  
 + 
  
 'formatting.' 
 , 
  
 ), 
  
 ) 
  
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newImage 
 (). 
 setImageUrl 
 ( 
  
 'https://www.example.com/images/mapsImage.png' 
 , 
  
 ), 
  
 ), 
  
 ) 
  
 . 
 addCardAction 
 ( 
  
 CardService 
 . 
 newCardAction 
 (). 
 setText 
 ( 
 'Gmail' 
 ). 
 setOpenLink 
 ( 
  
 CardService 
 . 
 newOpenLink 
 (). 
 setUrl 
 ( 
 'https://mail.google.com/mail' 
 ), 
  
 ), 
  
 ) 
  
 . 
 build 
 (); 
 } 

Sample for a Chat Apps card.

 const 
  
 cardHeader 
  
 = 
  
 CardService 
 . 
 newCardHeader 
 () 
  
 . 
 setTitle 
 ( 
 'Sasha' 
 ) 
  
 . 
 setSubtitle 
 ( 
 'Software Engineer' 
 ) 
  
 . 
 setImageUrl 
 ( 
  
 'https://developers.google.com/chat/images/quickstart-app-avatar.png' 
 , 
  
 ) 
  
 . 
 setImageStyle 
 ( 
 CardService 
 . 
 ImageStyle 
 . 
 CIRCLE 
 ) 
  
 . 
 setImageAltText 
 ( 
 'Avatar for Sasha' 
 ); 
 const 
  
 cardSection 
  
 = 
  
 CardService 
 . 
 newCardSection 
 () 
  
 . 
 setHeader 
 ( 
 'Contact Info' 
 ) 
  
 . 
 setCollapsible 
 ( 
 true 
 ) 
  
 . 
 setNumUncollapsibleWidgets 
 ( 
 1 
 ) 
  
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newDecoratedText 
 () 
  
 . 
 setStartIcon 
 ( 
  
 CardService 
 . 
 newIconImage 
 (). 
 setIcon 
 ( 
 CardService 
 . 
 Icon 
 . 
 EMAIL 
 )) 
  
 . 
 setText 
 ( 
 'sasha@example.com' 
 ), 
  
 ) 
  
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newDecoratedText 
 () 
  
 . 
 setStartIcon 
 ( 
  
 CardService 
 . 
 newIconImage 
 (). 
 setIcon 
 ( 
 CardService 
 . 
 Icon 
 . 
 PERSON 
 )) 
  
 . 
 setText 
 ( 
 '<font color="#80e27e">Online</font>' 
 ), 
  
 ) 
  
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newDecoratedText 
 () 
  
 . 
 setStartIcon 
 ( 
  
 CardService 
 . 
 newIconImage 
 (). 
 setIcon 
 ( 
 CardService 
 . 
 Icon 
 . 
 PHONE 
 )) 
  
 . 
 setText 
 ( 
 '+1 (555) 555-1234' 
 ), 
  
 ) 
  
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newButtonSet 
 () 
  
 . 
 addButton 
 ( 
  
 CardService 
 . 
 newTextButton 
 (). 
 setText 
 ( 
 'Share' 
 ). 
 setOpenLink 
 ( 
  
 CardService 
 . 
 newOpenLink 
 (). 
 setUrl 
 ( 
  
 'https://example.com/share' 
 ), 
  
 ), 
  
 ) 
  
 . 
 addButton 
 ( 
  
 CardService 
 . 
 newTextButton 
 () 
  
 . 
 setText 
 ( 
 'Edit' 
 ) 
  
 . 
 setOnClickAction 
 ( 
  
 CardService 
 . 
 newAction 
 () 
  
 . 
 setFunctionName 
 ( 
 'goToView' 
 ) 
  
 . 
 setParameters 
 ({ 
 viewType 
 : 
  
 'EDIT' 
 }), 
  
 ), 
  
 ), 
  
 ); 
 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 cardHeader 
 ) 
  
 . 
 addSection 
 ( 
 cardSection 
 ) 
  
 . 
 build 
 (); 

Properties

Property Type Description
Border Type
Border Type The Border Type enumeration.
Chip List Layout
Chip List Layout The Chip List Layout enumeration.
Composed Email Type
Composed Email Type The Composed Email Type enumeration.
Content Type
Content Type The Content Type enumeration.
Grid Item Layout
Grid Item Layout The Grid Item Layout enumeration.
Horizontal Alignment
Horizontal Alignment The Horizontal Alignment enumeration.
Icon
Icon The Icon enumeration.
Image Button Style
Image Button Style The Image Button Style enumeration.
Image Crop Type
Image Crop Type The Image Crop Type enumeration.
Image Style
Image Style The Image Style enumeration.
Input Type
Input Type The Input Type enumeration.
Load Indicator
Load Indicator The Load Indicator enumeration.
On Close
On Close The On Close enumeration.
Open As
Open As The Open As enumeration.
Selection Input Type
Selection Input Type The Selection Input Type enumeration.
Text Button Style
Text Button Style The Text Button Style enumeration.
Update Draft Body Type
Update Draft Body Type The Update Draft Body Type enumeration.

Methods

Method Return type Brief description
Action Creates a new Action .
Action Response Builder Creates a new Action Response Builder .
Action Status Creates a new Action Status .
Attachment Creates a new Attachment .
Authorization Action Creates a new Authorization Action .
Authorization Exception Creates a new Authorization Exception .
Border Style Creates a new Border Style .
Button Set Creates a new Button Set .
Calendar Event Action Response Builder Creates a new Calendar Event Action Response Builder .
Card Action Creates a new Card Action .
Card Builder Creates a new Card builder.
Card Header Creates a new Card Header .
Card Section Creates a new Card Section .
Card With Id Creates a new Card With Id .
Carousel Creates a Carousel .
Carousel Card Creates a new Carousel Card .
Chat Action Response Creates a new Chat Action Response .
Chat Response Builder Creates a new Chat Response Builder .
Chip Creates a new Chip .
Chip List Creates a new Chip List .
Collapse Control Creates a new Collapse Control .
Column Creates a new Column .
Columns Creates a new set of Columns .
Compose Action Response Builder Creates a new Compose Action Response Builder .
Date Picker Creates a new Date Picker .
Date Time Picker Creates a new Date Time Picker .
Decorated Text Creates a new Decorated Text .
Dialog Creates a new Dialog .
Dialog Action Creates a new Dialog Action .
Divider Creates a new Divider .
Drive Items Selected Action Response Builder Creates a new Drive Items Selected Action Response Builder .
Editor File Scope Action Response Builder Creates a new Editor File Scope Action Response Builder .
Fixed Footer Creates a new Fixed Footer .
Grid Creates a new Grid .
Grid Item Creates a new Grid Item .
Icon Image Creates a new Icon Image .
Image Creates a new Image .
Image Button Creates a new Image Button .
Image Component Creates a new Image Component .
Image Crop Style Creates a new Image Crop Style .
Key Value Creates a new Key Value .
Link Preview Creates a new Link Preview .
Material Icon Creates a new Material Icon .
Navigation Creates a new Navigation .
Notification Creates a new Notification .
Open Link Creates a new Open Link .
Overflow Menu Creates a new Overflow Menu .
Overflow Menu Item Creates a new Overflow Menu Item .
Selection Input Creates a new Selection Input .
Suggestions Creates a new Suggestions .
Suggestions Response Builder Creates a new Suggestions Response Builder .
Switch Creates a new Switch .
Text Button Creates a new Text Button .
Text Input Creates a new Text Input .
Text Paragraph Creates a new Text Paragraph .
Time Picker Creates a new Time Picker .
Universal Action Response Builder Creates a new Universal Action Response Builder .
Update Draft Action Response Builder Creates a new Update Draft Action Response Builder .
Update Draft Bcc Recipients Action Creates a new Update Draft Bcc Recipients Action ;
Update Draft Body Action Creates a new Update Draft Body Action .
Update Draft Cc Recipients Action Creates a new Update Draft Cc Recipients Action .
Update Draft Subject Action Creates a new Update Draft Subject Action .
Update Draft To Recipients Action Creates a new Update Draft To Recipients Action .
Validation Creates a new Validation .

Detailed documentation

new Action()

Creates a new Action .

Return

Action — An empty Action.


new Action Response Builder()

Creates a new Action Response Builder .

Return

Action Response Builder — An empty ActionResponse builder.


new Action Status()

Creates a new Action Status .

Only available for Google Chat apps. Not available for Google Workspace add-ons.

 const 
  
 actionStatus 
  
 = 
  
 CardService 
 . 
 newActionStatus 
 () 
  
 . 
 setStatusCode 
 ( 
 CardService 
 . 
 Status 
 . 
 OK 
 ) 
  
 . 
 setUserFacingMessage 
 ( 
 'Success' 
 ); 

Return

Action Status — An empty ActionStatus.


new Attachment()

Creates a new Attachment .

Return

Attachment — An empty attachment.


new Authorization Action()

Creates a new Authorization Action .

Return

Authorization Action — An empty AuthorizationAction.


new Authorization Exception()

Creates a new Authorization Exception .

Return

Authorization Exception — An empty AuthorizationException.


new Border Style()

Creates a new Border Style .

Return

Border Style — An empty BorderStyle.


new Button Set()

Creates a new Button Set .

Return

Button Set — An empty ButtonSet.


new Calendar Event Action Response Builder()


new Card Action()

Creates a new Card Action .

Return

Card Action — An empty CardAction.


new Card Builder()

Creates a new Card builder.

Return

Card Builder — An empty Card builder.


new Card Header()

Creates a new Card Header .

Return

Card Header — An empty CardHeader.


new Card Section()

Creates a new Card Section .

Return

Card Section — An empty CardSection.


new Card With Id()

Creates a new Card With Id . This is used to send a card in a Google Chat message. card ID is a unique identifier for a card in a message when sending multiple cards.

Only available for Google Chat apps. Not available for Google Workspace add-ons.

 const 
  
 cardSection 
  
 = 
  
 CardService 
 . 
 newCardSection 
 (); 
 cardSection 
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'This is a text paragraph widget.' 
 ), 
 ); 
 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'Card title' 
 )) 
  
 . 
 addSection 
 ( 
 cardSection 
 ) 
  
 . 
 build 
 (); 
 const 
  
 cardWithId 
  
 = 
  
 CardService 
 . 
 newCardWithId 
 (). 
 setCardId 
 ( 
 'card_id' 
 ). 
 setCard 
 ( 
 card 
 ); 

Return

Card With Id — An empty Card With Id .


new Carousel()

Creates a Carousel .

 const 
  
 carousel 
  
 = 
  
 CardService 
 . 
 newCarousel 
 () 
  
 . 
 addCarouselCard 
 ( 
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'The first text paragraph in carousel' 
 ))) 
  
 . 
 addCarouselCard 
 ( 
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'The second text paragraph in carousel' 
 ))) 
  
 . 
 addCarouselCard 
 ( 
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'The third text paragraph in carousel' 
 ))) 

Return

Carousel — An empty Carousel.


new Carousel Card()

Creates a new Carousel Card .

 const 
  
 carouselCard 
  
 = 
  
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'Text paragraph in carousel' 
 )); 

Return

Carousel Card — An empty Chip.


new Chat Action Response()

Creates a new Chat Action Response .

Only available for Google Chat apps. Not available for Google Workspace add-ons.

 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'Card title' 
 )) 
  
 . 
 build 
 (); 
 const 
  
 dialog 
  
 = 
  
 CardService 
 . 
 newDialog 
 (). 
 setBody 
 ( 
 card 
 ); 
 const 
  
 dialogAction 
  
 = 
  
 CardService 
 . 
 newDialogAction 
 (). 
 setDialog 
 ( 
 dialog 
 ); 
 const 
  
 chatActionResponse 
  
 = 
  
 CardService 
 . 
 newChatActionResponse 
 () 
  
 . 
 setResponseType 
 ( 
 CardService 
 . 
 ResponseType 
 . 
 DIALOG 
 ) 
  
 . 
 setDialogAction 
 ( 
 dialogAction 
 ); 

Return

Chat Action Response — An empty Chat Action Response .


new Chat Response Builder()

Creates a new Chat Response Builder .

Only available for Google Chat apps. Not available for Google Workspace add-ons.

 const 
  
 cardSection 
  
 = 
  
 CardService 
 . 
 newCardSection 
 (); 
 cardSection 
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'This is a text paragraph widget.' 
 ), 
 ); 
 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'Card title' 
 )) 
  
 . 
 addSection 
 ( 
 cardSection 
 ) 
  
 . 
 build 
 (); 
 const 
  
 cardWithId 
  
 = 
  
 CardService 
 . 
 newCardWithId 
 (). 
 setCardId 
 ( 
 'card_id' 
 ). 
 setCard 
 ( 
 card 
 ); 
 const 
  
 chatResponse 
  
 = 
  
 CardService 
 . 
 newChatResponseBuilder 
 (). 
 addCardsV2 
 ( 
 cardWithId 
 ). 
 build 
 (); 

Return

Chat Response Builder — An empty ChatResponseBuilder.


new Chip()

Creates a new Chip .

Available for Google Chat apps. In developer preview for Google Workspace add-ons.

 const 
  
 chip 
  
 = 
  
 CardService 
 . 
 newChip 
 () 
  
 . 
 setLabel 
 ( 
 'Open Link' 
 ) 
  
 . 
 setOpenLink 
 ( 
 CardService 
 . 
 newOpenLink 
 (). 
 setUrl 
 ( 
  
 'https://www.google.com' 
 )); 

Return

Chip — An empty Chip.


new Chip List()

Creates a new Chip List .

Available for Google Chat apps. In developer preview for Google Workspace add-ons.

 const 
  
 chip 
  
 = 
  
 CardService 
 . 
 newChip 
 (); 
 // Finish building the text chip... 
 const 
  
 chipList 
  
 = 
  
 CardService 
 . 
 newChipList 
 () 
  
 . 
 setLayout 
 ( 
 CardService 
 . 
 ChipListLayout 
 . 
 WRAPPED 
 ) 
  
 . 
 addChip 
 ( 
 chip 
 ); 

Return

Chip List — An empty ChipList.


new Collapse Control()

Creates a new Collapse Control .

Available for Google Chat apps. In developer preview for Google Workspace add-ons.

 const 
  
 collapseControl 
  
 = 
  
 CardService 
 . 
 newCollapseControl 
 () 
  
 . 
 setHorizontalAlign 
 ( 
 CardService 
 . 
 HorizontalAlignment 
 . 
 START 
 ) 
  
 . 
 setExpandButton 
 ( 
 CardService 
 . 
 newTextButton 
 (). 
 setText 
 ( 
 'Expand' 
 )) 
  
 . 
 setCollapseButton 
 ( 
 CardService 
 . 
 newTextButton 
 (). 
 setText 
 ( 
 'Collapse' 
 )); 

Return

Collapse Control — An empty CollapseControl.


new Column()

Creates a new Column .

Available for Google Chat apps and Google Workspace add-ons.

 const 
  
 columnWidget 
  
 = 
  
 CardService 
 . 
 newTextParagraph 
 (); 
 const 
  
 column 
  
 = 
  
 CardService 
 . 
 newColumn 
 () 
  
 . 
 setHorizontalSizeStyle 
 ( 
  
 CardService 
 . 
 HorizontalSizeStyle 
 . 
 FILL_AVAILABLE_SPACE 
 ) 
  
 . 
 setHorizontalAlignment 
 ( 
 CardService 
 . 
 HorizontalAlignment 
 . 
 CENTER 
 ) 
  
 . 
 setVerticalAlignment 
 ( 
 CardService 
 . 
 VerticalAlignment 
 . 
 CENTER 
 ) 
  
 . 
 addWidget 
 ( 
 columnWidget 
 ); 

Return

Column — An empty Column.


new Columns()

Creates a new set of Columns .

Available for Google Chat apps and Google Workspace add-ons.

 const 
  
 firstColumn 
  
 = 
  
 CardService 
 . 
 newColumn 
 () 
  
 . 
 setHorizontalSizeStyle 
 ( 
  
 CardService 
 . 
 HorizontalSizeStyle 
 . 
 FILL_AVAILABLE_SPACE 
 ) 
  
 . 
 setHorizontalAlignment 
 ( 
 CardService 
 . 
 HorizontalAlignment 
 . 
 CENTER 
 ) 
  
 . 
 setVerticalAlignment 
 ( 
 CardService 
 . 
 VerticalAlignment 
 . 
 CENTER 
 ); 
 const 
  
 secondColumn 
  
 = 
  
 CardService 
 . 
 newColumn 
 () 
  
 . 
 setHorizontalSizeStyle 
 ( 
  
 CardService 
 . 
 HorizontalSizeStyle 
 . 
 FILL_AVAILABLE_SPACE 
 ) 
  
 . 
 setHorizontalAlignment 
 ( 
 CardService 
 . 
 HorizontalAlignment 
 . 
 CENTER 
 ) 
  
 . 
 setVerticalAlignment 
 ( 
 CardService 
 . 
 VerticalAlignment 
 . 
 CENTER 
 ); 
 const 
  
 columns 
  
 = 
  
 CardService 
 . 
 newColumns 
 () 
  
 . 
 addColumn 
 ( 
 firstColumn 
 ) 
  
 . 
 addColumn 
 ( 
 secondColumn 
 ) 
  
 . 
 setWrapStyle 
 ( 
 CardService 
 . 
 WrapStyle 
 . 
 WRAP 
 ); 

Return

Columns — An empty set of Columns.


new Compose Action Response Builder()

Creates a new Compose Action Response Builder .

Return

Compose Action Response Builder — An empty ComposeActionResponse builder.


new Date Picker()

Creates a new Date Picker .

Return

Date Picker — An empty DatePicker.


new Date Time Picker()

Creates a new Date Time Picker .

Return

Date Time Picker — An empty DateTimePicker.


new Decorated Text()

Creates a new Decorated Text .

Return

Decorated Text — An empty DecoratedText.


new Dialog()

Creates a new Dialog .

Only available for Google Chat apps. Not available for Google Workspace add-ons.

 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'Card title' 
 )) 
  
 . 
 build 
 (); 
 // Sets the card of the dialog. 
 const 
  
 dialog 
  
 = 
  
 CardService 
 . 
 newDialog 
 (). 
 setBody 
 ( 
 card 
 ); 

Return

Dialog — An empty Dialog .


new Dialog Action()

Creates a new Dialog Action .

Only available for Google Chat apps. Not available for Google Workspace add-ons.

 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'Card title' 
 )) 
  
 . 
 build 
 (); 
 const 
  
 dialog 
  
 = 
  
 CardService 
 . 
 newDialog 
 (). 
 setBody 
 ( 
 card 
 ); 
 const 
  
 dialogAction 
  
 = 
  
 CardService 
 . 
 newDialogAction 
 (). 
 setDialog 
 ( 
 dialog 
 ); 

Return

Dialog Action — An empty Dialog Action .


new Divider()

Creates a new Divider . The following sample builds a simple card with 2 paragraphs separated by a divider.

 function 
  
 buildCard 
 () 
  
 { 
  
 const 
  
 cardSection1TextParagraph1 
  
 = 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'Hello world!' 
 ); 
  
 const 
  
 cardSection1Divider1 
  
 = 
  
 CardService 
 . 
 newDivider 
 (); 
  
 const 
  
 cardSection1TextParagraph2 
  
 = 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'Hello world!' 
 ); 
  
 const 
  
 cardSection1 
  
 = 
  
 CardService 
 . 
 newCardSection 
 () 
  
 . 
 addWidget 
 ( 
 cardSection1TextParagraph1 
 ) 
  
 . 
 addWidget 
 ( 
 cardSection1Divider1 
 ) 
  
 . 
 addWidget 
 ( 
 cardSection1TextParagraph2 
 ); 
  
 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 (). 
 addSection 
 ( 
 cardSection1 
 ). 
 build 
 (); 
  
 return 
  
 card 
 ; 
 } 

Return

Divider — A divider.


new Drive Items Selected Action Response Builder()


new Editor File Scope Action Response Builder()


new Fixed Footer()

Creates a new Fixed Footer .

Return

Fixed Footer — An empty FixedFooter.


new Grid()

Creates a new Grid .

Return

Grid — An empty Grid.


new Grid Item()

Creates a new Grid Item .

Return

Grid Item — An empty GridItem.


new Icon Image()

Creates a new Icon Image .

Return

Icon Image — An empty icon image.


new Image()

Creates a new Image .

Return

Image — An empty Image.


new Image Button()

Creates a new Image Button .

Return

Image Button — An empty ImageButton.


new Image Component()

Creates a new Image Component .

Return

Image Component — An empty ImageComponent.


new Image Crop Style()

Creates a new Image Crop Style .

Return

Image Crop Style — An empty ImageCropStyle.


new Key Value()

Creates a new Key Value .

Return

Key Value — An empty KeyValue.


new Link Preview()

Creates a new Link Preview .

 const 
  
 decoratedText 
  
 = 
  
 CardService 
 . 
 newDecoratedText 
 (). 
 setTopLabel 
 ( 
 'Hello' 
 ). 
 setText 
 ( 
 'Hi!' 
 ); 
 const 
  
 cardSection 
  
 = 
  
 CardService 
 . 
 newCardSection 
 (). 
 addWidget 
 ( 
 decoratedText 
 ); 
 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 (). 
 addSection 
 ( 
 cardSection 
 ). 
 build 
 (); 
 const 
  
 linkPreview 
  
 = 
  
 CardService 
 . 
 newLinkPreview 
 (). 
 setPreviewCard 
 ( 
 card 
 ). 
 setTitle 
 ( 
  
 'Smart chip title' 
 ); 

Return

Link Preview — An empty LinkPreview.


new Material Icon()

Creates a new Material Icon .

Available for Google Chat apps and Google Workspace add-ons.

 const 
  
 materialIcon 
  
 = 
  
 CardService 
 . 
 newMaterialIcon 
 (). 
 setName 
 ( 
 'check_box' 
 ). 
 setFill 
 ( 
 true 
 ); 
 const 
  
 cardSection 
  
 = 
  
 CardService 
 . 
 newCardSection 
 (); 
 cardSection 
 . 
 addWidget 
 ( 
  
 CardService 
 . 
 newDecoratedText 
 () 
  
 . 
 setStartIcon 
 ( 
 CardService 
 . 
 newIconImage 
 (). 
 setMaterialIcon 
 ( 
 materialIcon 
 )) 
  
 . 
 setText 
 ( 
 'sasha@example.com' 
 ), 
 ); 
 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'Card Title' 
 )) 
  
 . 
 addSection 
 ( 
 cardSection 
 ) 
  
 . 
 build 
 (); 

Return

Material Icon — An empty MaterialIcon.


new Navigation()

Creates a new Navigation .

Return

Navigation — An empty Navigation.


new Notification()

Creates a new Notification .

Return

Notification — An empty Notification.


Creates a new Open Link .

Return

Open Link — An empty OpenLink.


new Overflow Menu()

Creates a new Overflow Menu .

Available for Google Chat apps. In developer preview for Google Workspace add-ons.

 const 
  
 overflowMenuItem 
  
 = 
  
 CardService 
 . 
 newOverflowMenuItem 
 (); 
 // Finish building the overflow menu item... 
 const 
  
 overflowMenu 
  
 = 
  
 CardService 
 . 
 newOverflowMenu 
 (). 
 addMenuItem 
 ( 
 overflowMenuItem 
 ); 

Return

Overflow Menu — An empty OverflowMenu.


new Overflow Menu Item()

Creates a new Overflow Menu Item .

Available for Google Chat apps. In developer preview for Google Workspace add-ons.

 const 
  
 overflowMenuItem 
  
 = 
  
 CardService 
 . 
 newOverflowMenuItem 
 () 
  
 . 
 setStartIcon 
 ( 
  
 CardService 
 . 
 newIconImage 
 (). 
 setIconUrl 
 ( 
  
 'https://www.google.com/images/branding/googleg/1x/googleg_standard_color_64dp.png' 
 , 
  
 ), 
  
 ) 
  
 . 
 setText 
 ( 
 'Open Link' 
 ) 
  
 . 
 setOpenLink 
 ( 
  
 CardService 
 . 
 newOpenLink 
 (). 
 setUrl 
 ( 
 'https://www.google.com' 
 )); 

Return

Overflow Menu Item — An empty OverflowMenuItem.


new Selection Input()

Creates a new Selection Input .

Return

Selection Input — An empty SelectionInput.


new Suggestions()

Creates a new Suggestions .

Return

Suggestions — An empty Suggestions.


new Suggestions Response Builder()

Creates a new Suggestions Response Builder .

Return

Suggestions Response Builder — An empty SuggestionsResponse builder.


new Switch()

Creates a new Switch .

Return

Switch — An empty Switch.


new Text Button()

Creates a new Text Button .

Return

Text Button — An empty TextButton.


new Text Input()

Creates a new Text Input .

Return

Text Input — An empty TextInput.


new Text Paragraph()

Creates a new Text Paragraph .

Return

Text Paragraph — An empty TextParagraph.


new Time Picker()

Creates a new Time Picker .

Return

Time Picker — An empty TimePicker.


new Universal Action Response Builder()

Creates a new Universal Action Response Builder .

Return

Universal Action Response Builder — An empty UniversalActionResponse builder.


new Update Draft Action Response Builder()

Creates a new Update Draft Action Response Builder .

Return

Update Draft Action Response Builder — An empty UpdateDraftActionResponseBuilder.


new Update Draft Bcc Recipients Action()

Creates a new Update Draft Bcc Recipients Action ;

Return

Update Draft Bcc Recipients Action — An empty UpdateDraftBccRecipientsAction.


new Update Draft Body Action()

Creates a new Update Draft Body Action .

Return

Update Draft Body Action — An empty UpdateDraftBodyAction.


new Update Draft Cc Recipients Action()

Creates a new Update Draft Cc Recipients Action .

Return

Update Draft Cc Recipients Action — An Empty UpdateDraftCcRecipientsAction.


new Update Draft Subject Action()

Creates a new Update Draft Subject Action .

Return

Update Draft Subject Action — An empty UpdateDraftSubjectAction.


new Update Draft To Recipients Action()

Creates a new Update Draft To Recipients Action .

Return

Update Draft To Recipients Action — An empty UpdateDraftToRecipientsAction.


new Validation()

Creates a new Validation .

Available for Google Chat apps and Google Workspace add-ons.

 const 
  
 validation 
  
 = 
  
 CardService 
 . 
 newValidation 
 (). 
 setCharacterLimit 
 ( 
 5 
 ). 
 setInputType 
 ( 
  
 CardService 
 . 
 InputType 
 . 
 EMAIL 
 ); 

Return

Validation — An empty validation.

Create a Mobile Website
View Site in Mobile | Classic
Share by: