Class AddOnsResponseService

AddOnsResponseService

AddOnsResponseService 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

newAccessoryWidget()

Creates a new AccessoryWidget .

 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

AccessoryWidget — An empty AccessoryWidget.


newAction()

Creates a new Action .

Return

Action — An empty Action.


newActionResponseBuilder()

Creates a ActionResponseBuilder .

 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

ActionResponseBuilder — An empty ActionResponse builder.


newAddonComposeUiActionResponseBuilder()

Creates a AddonComposeUiActionResponseBuilder .

Return

AddonComposeUiActionResponseBuilder — An empty AddonComposeUiActionResponseBuilder.


newAttachment()

Creates a Attachment .

Return

Attachment — An empty attachment.


newCalendarEventActionResponseBuilder()


newChatDataActionBuilder()

Creates a ChatDataActionsResponseBuilder .

 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

ChatDataActionsResponseBuilder — An empty ChatDataActionsResponseBuilder.


newChatMessage()

Creates a ChatMessage .

 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

ChatMessage — An empty ChatMessage.


newComposeActionResponseBuilder()

Creates a ComposeActionResponseBuilder .

Return

ComposeActionResponseBuilder — An empty ComposeActionResponse builder.


newCreateMessageAction()

Creates a CreateMessageAction .

 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

CreateMessageAction — An empty CreateMessageAction.


newDriveItemsSelectedActionResponseBuilder()


newEditorFileScopeActionResponseBuilder()


newLinkPreview()

Creates a LinkPreview .

Return

LinkPreview — An empty LinkPreview.


newNavigation()

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.


newNotification()

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 OpenLink .

Return

OpenLink — An empty OpenLink.


newRenderActionBuilder()

Creates a new RenderActionBuilder .

Return

RenderActionBuilder — An empty RenderActionBuilder.


newUniversalActionResponseBuilder()

Creates a UniversalActionResponseBuilder .

Return

UniversalActionResponseBuilder — An empty UniversalActionResponse builder.


newUpdateDraftActionResponseBuilder()

Creates a UpdateDraftActionResponseBuilder .

Return

UpdateDraftActionResponseBuilder — An empty UpdateDraftActionResponseBuilder.


newUpdateDraftBccRecipientsAction()

Creates a UpdateDraftBccRecipientsAction ;

Return

UpdateDraftBccRecipientsAction — An empty UpdateDraftBccRecipientsAction.


newUpdateDraftBodyAction()

Creates a UpdateDraftBodyAction .

Return

UpdateDraftBodyAction — An empty UpdateDraftBodyAction.


newUpdateDraftCcRecipientsAction()

Creates a UpdateDraftCcRecipientsAction .

Return

UpdateDraftCcRecipientsAction — An Empty UpdateDraftCcRecipientsAction.


newUpdateDraftSubjectAction()

Creates a UpdateDraftSubjectAction .

Return

UpdateDraftSubjectAction — An empty UpdateDraftSubjectAction.


newUpdateDraftToRecipientsAction()

Creates a UpdateDraftToRecipientsAction .

Return

UpdateDraftToRecipientsAction — An empty UpdateDraftToRecipientsAction.


newUpdateInlinePreviewAction()

Creates a UpdateInlinePreviewAction .

 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

UpdateInlinePreviewAction — An empty UpdateInlinePreviewAction.


newUpdateMessageAction()

Creates a UpdateMessageAction .

 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

UpdateMessageAction — An empty UpdateMessageAction.

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