Class ChatActionResponse

ChatActionResponse

Chat アプリがレスポンスの送信方法を構成するために使用できるパラメータを表すクラス。

Google Chat アプリでのみ使用できます。Google Workspace アドオンでは利用できません。

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.Type.DIALOG)
   .setDialogAction(dialogAction);

Methods

メソッド戻り値の型概要
setDialogAction(dialogAction)ChatActionResponseダイアログ アクションをダイアログに関連するイベントに設定します。
setResponseType(responseType)ChatActionResponseChat アプリのレスポンスの種類。
setUpdatedWidget(updatedWidget)ChatActionResponseウィジェットのオートコンプリート オプションを提供するために使用される、更新されたウィジェットを設定します。
setUrl(url)ChatActionResponseユーザーが認証または構成するための URL。

詳細なドキュメント

setDialogAction(dialogAction)

ダイアログ アクションをダイアログに関連するイベントに設定します。

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.Type.DIALOG)
   .setDialogAction(dialogAction);

パラメータ

名前説明
dialogActionDialogAction設定するダイアログ アクション。

リターン

ChatActionResponse - チェーン用のこのオブジェクト。


setResponseType(responseType)

Chat アプリのレスポンスの種類。

const chatActionResponse = CardService.newChatActionResponse()
   .setResponseType(CardService.Type.DIALOG)

パラメータ

名前説明
responseTypeResponseTypeレスポンス タイプ。

リターン

ChatActionResponse - チェーン用のこのオブジェクト。


setUpdatedWidget(updatedWidget)

ウィジェットのオートコンプリート オプションを提供するために使用される、更新したウィジェットを設定します。

const updatedWidget = CardService.newUpdatedWidget()
    .addItem("Contact 1", "contact-1", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact one description")
    .addItem("Contact 2", "contact-2", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact two description")
    .addItem("Contact 3", "contact-3", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact three description")
    .addItem("Contact 4", "contact-4", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact four description")
    .addItem("Contact 5", "contact-5", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact five description");

const actionResponse = CardService.newChatActionResponse()
    .setUpdatedWidget(updatedWidget)
    .setResponseType(CardService.ResponseType.UPDATE_WIDGET);
Google Chat アプリでのみ使用できます。Google Workspace アドオンでは利用できません。

パラメータ

名前説明
updatedWidgetUpdatedWidget設定される更新されたウィジェット。

リターン

ChatActionResponse - チェーン用のこのオブジェクト。


setUrl(url)

ユーザーが認証または構成するための URL。REQUEST_CONFIG レスポンス タイプのみ。

const chatActionResponse = CardService.newChatActionResponse()
   .setResponseType(CardService.Type.REQUEST_CONFIG)
   .setUrl('https://www.google.com');

パラメータ

名前説明
urlString送信する URL。

リターン

ChatActionResponse - チェーン用のこのオブジェクト。