Class AddOnsResponseService

Add Ons Response Service

Add Ons Response Service provides the ability to create responses for Google Workspace add-ons.

Sample usage:

 function 
  
 myFunction 
 () 
  
 { 
  
 return 
  
 AddOnsResponseService 
 . 
 newChatDataActionBuilder 
 (); 
 } 

The following example shows how a Chat app responds with a dialog:

 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 () 
 . 
 setTitle 
 ( 
 "Card Title" 
 )) 
  
 . 
 addSection 
 ( 
 CardService 
 . 
 newCardSection 
 () 
  
 . 
 addWidget 
 ( 
 CardService 
 . 
 newTextParagraph 
 () 
 . 
 setText 
 ( 
 "Text paragraph" 
 ))) 
  
 . 
 build 
 (); 
 const 
  
 actionResponse 
  
 = 
  
 AddOnsResponseService 
 . 
 newActionResponseBuilder 
 () 
  
 . 
 setNavigation 
 ( 
 AddOnsResponseService 
 . 
 newNavigation 
 () 
 . 
 pushCard 
 ( 
 card 
 )) 
  
 . 
 build 
 (); 

The following example shows how a Chat app responds with a link preview card:

 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 
 (); 

Properties

Property Type Description
Addon Compose Ui Action Type
Addon Compose Ui Action Type The Addon Compose Ui Action Type enumeration.
Composed Email Type
Composed Email Type The Composed Email Type enumeration.
Content Type
Content Type The Content Type enumeration.
End Navigation
End Navigation The End Navigation enumeration.
On Close
On Close The On Close enumeration.
Open As
Open As The Open As enumeration.
Send Status
Send Status The Send Status enumeration.
Update Draft Body Type
Update Draft Body Type The Update Draft Body Type enumeration.

Methods

Method Return type Brief description
Accessory Widget Creates a new Accessory Widget .
Action Creates a new Action .
Action Response Builder Creates a Action Response Builder .
Addon Compose Ui Action Response Builder Creates a Addon Compose Ui Action Response Builder .
Attachment Creates a Attachment .
Calendar Event Action Response Builder Creates a Calendar Event Action Response Builder .
Chat Data Actions Response Builder Creates a Chat Data Actions Response Builder .
Chat Message Creates a Chat Message .
Compose Action Response Builder Creates a Compose Action Response Builder .
Create Message Action Creates a Create Message Action .
Drive Items Selected Action Response Builder Creates a Drive Items Selected Action Response Builder .
Editor File Scope Action Response Builder Creates a Editor File Scope Action Response Builder .
Link Preview Creates a Link Preview .
Navigation Creates a Navigation .
Notification Creates a Notification .
Open Link Creates a Open Link .
Render Action Builder Creates a new Render Action Builder .
Universal Action Response Builder Creates a Universal Action Response Builder .
Update Draft Action Response Builder Creates a Update Draft Action Response Builder .
Update Draft Bcc Recipients Action Creates a Update Draft Bcc Recipients Action ;
Update Draft Body Action Creates a Update Draft Body Action .
Update Draft Cc Recipients Action Creates a Update Draft Cc Recipients Action .
Update Draft Subject Action Creates a Update Draft Subject Action .
Update Draft To Recipients Action Creates a Update Draft To Recipients Action .
Update Inline Preview Action Creates a Update Inline Preview Action .
Update Message Action Creates a Update Message Action .

Detailed documentation

new Accessory Widget()

Creates a new Accessory Widget .

 const 
  
 widget 
  
 = 
  
 CardService 
 . 
 newButtonSet 
 () 
  
 . 
 addButton 
 ( 
 CardService 
 . 
 newImageButton 
 () 
  
 . 
 setIcon 
 ( 
 CardService 
 . 
 Icon 
 . 
 PHONE 
 ) 
  
 . 
 setOnClickAction 
 ( 
 CardService 
 . 
 newAction 
 () 
  
 . 
 setFunctionName 
 ( 
 "phone" 
 ))) 
  
 . 
 addButton 
 ( 
 CardService 
 . 
 newTextButton 
 () 
  
 . 
 setText 
 ( 
 "Robot" 
 ) 
  
 . 
 setIconUrl 
 ( 
 "https://developers.google.com/chat/images/quickstart-app-avatar.png" 
 ) 
  
 . 
 setOnClickAction 
 ( 
 CardService 
 . 
 newAction 
 () 
  
 . 
 setFunctionName 
 ( 
 "robot" 
 ))); 
 const 
  
 accessoryWidget 
  
 = 
  
 AddOnsResponseService 
 . 
 newAccessoryWidget 
 () 
  
 . 
 addWidget 
 ( 
 widget 
 ); 

Return

Accessory Widget — An empty AccessoryWidget.


new Action()

Creates a new Action .

Return

Action — An empty Action.


new Action Response Builder()

Creates a Action Response Builder .

 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 "Card Title" 
 )) 
  
 . 
 addSection 
 ( 
 CardService 
 . 
 newCardSection 
 () 
  
 . 
 addWidget 
 ( 
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 "Text paragraph" 
 ))) 
  
 . 
 build 
 (); 
 const 
  
 actionResponse 
  
 = 
  
 AddOnsResponseService 
 . 
 newActionResponseBuilder 
 () 
  
 . 
 setNavigation 
 ( 
 AddOnsResponseService 
 . 
 newNavigation 
 (). 
 pushCard 
 ( 
 card 
 )) 
  
 . 
 build 
 (); 

Return

Action Response Builder — An empty ActionResponse builder.


new Addon Compose Ui Action Response Builder()

Creates a Addon Compose Ui Action Response Builder .

Return

Addon Compose Ui Action Response Builder — An empty AddonComposeUiActionResponseBuilder.


new Attachment()

Creates a Attachment .

Return

Attachment — An empty attachment.


new Calendar Event Action Response Builder()


new Chat Data Action Builder()

Creates a Chat Data Actions Response Builder .

 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 
 ); 
 const 
  
 chatDataAction 
  
 = 
  
 AddOnsResponseService 
 . 
 newChatDataActionBuilder 
 () 
  
 . 
 setCreateChatMessageAction 
 ( 
 AddOnsResponseService 
 . 
 newCreateMessageAction 
 () 
  
 . 
 setMessage 
 ( 
 message 
 )) 
  
 . 
 build 
 (); 

Return

Chat Data Actions Response Builder — An empty AddOnsResponse builder.


new Chat Message()

Creates a Chat 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 
 ); 

Return

Chat Message — An empty ChatMessage.


new Compose Action Response Builder()

Creates a Compose Action Response Builder .

Return

Compose Action Response Builder — An empty ComposeActionResponse builder.


new Create Message Action()

Creates a Create Message Action .

 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 
 ); 
 const 
  
 chatDataAction 
  
 = 
  
 AddOnsResponseService 
 . 
 newChatDataActionBuilder 
 () 
  
 . 
 setCreateChatMessageAction 
 ( 
 AddOnsResponseService 
 . 
 newCreateMessageAction 
 () 
  
 . 
 setMessage 
 ( 
 message 
 )) 
  
 . 
 build 
 (); 

Return

Create Message Action — An empty CreateMessageAction.


new Drive Items Selected Action Response Builder()


new Editor File Scope Action Response Builder()


new Link Preview()

Creates a Link Preview .

Return

Link Preview — An empty LinkPreview.


new Navigation()

Creates a Navigation .

 const 
  
 card 
  
 = 
  
 CardService 
 . 
 newCardBuilder 
 () 
  
 . 
 setHeader 
 ( 
 CardService 
 . 
 newCardHeader 
 (). 
 setTitle 
 ( 
 'Card title' 
 )) 
  
 . 
 addSection 
 ( 
 cardSection 
 ) 
  
 . 
 build 
 (); 
 const 
  
 navigation 
  
 = 
  
 AddOnsResponseService 
 . 
 newNavigation 
 () 
  
 . 
 pushCard 
 ( 
 card 
 ); 

Return

Navigation — An empty Navigation.


new Notification()

Creates a Notification .

 const 
  
 notification 
  
 = 
  
 AddOnsResponseService 
 . 
 newNotification 
 (). 
 setText 
 ( 
 "You closed a dialog!" 
 ); 
 const 
  
 navigation 
  
 = 
  
 AddOnsResponseService 
 . 
 newNavigation 
 () 
  
 . 
 setEndNavigation 
 ( 
 AddOnsResponseService 
 . 
 EndNavigation 
 . 
 CLOSE_DIALOG 
 ); 

Return

Notification — An empty Notification.


Creates a Open Link .

Return

Open Link — An empty OpenLink.


new Render Action Builder()

Creates a new Render Action Builder .

Return

Render Action Builder — An empty RenderActionBuilder.


new Universal Action Response Builder()

Creates a Universal Action Response Builder .

Return

Universal Action Response Builder — An empty UniversalActionResponse builder.


new Update Draft Action Response Builder()

Creates a Update Draft Action Response Builder .

Return

Update Draft Action Response Builder — An empty UpdateDraftActionResponseBuilder.


new Update Draft Bcc Recipients Action()

Creates a Update Draft Bcc Recipients Action ;

Return

Update Draft Bcc Recipients Action — An empty UpdateDraftBccRecipientsAction.


new Update Draft Body Action()

Creates a Update Draft Body Action .

Return

Update Draft Body Action — An empty UpdateDraftBodyAction.


new Update Draft Cc Recipients Action()

Creates a Update Draft Cc Recipients Action .

Return

Update Draft Cc Recipients Action — An Empty UpdateDraftCcRecipientsAction.


new Update Draft Subject Action()

Creates a Update Draft Subject Action .

Return

Update Draft Subject Action — An empty UpdateDraftSubjectAction.


new Update Draft To Recipients Action()

Creates a Update Draft To Recipients Action .

Return

Update Draft To Recipients Action — An empty UpdateDraftToRecipientsAction.


new Update Inline Preview Action()

Creates a Update Inline Preview 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 
 (); 

Return

Update Inline Preview Action — An empty UpdateInlinePreviewAction.


new Update Message Action()

Creates a Update Message Action .

 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 
 ); 
 const 
  
 chatDataAction 
  
 = 
  
 AddOnsResponseService 
 . 
 newChatDataActionBuilder 
 () 
  
 . 
 setUpdateChatMessageAction 
 ( 
 AddOnsResponseService 
 . 
 newUpdateMessageAction 
 () 
  
 . 
 setMessage 
 ( 
 message 
 )) 
  
 . 
 build 
 (); 

Return

Update Message Action — An empty UpdateMessageAction.

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