Class ChatActionResponse

ChatActionResponse

Bir Chat uygulamasının, yanıtının nasıl olacağını yapılandırmak için kullanabileceği parametreleri temsil eden sınıf yayın gönderdi.

Yalnızca Google Chat uygulamalarında kullanılabilir. Google Workspace eklentileriyle kullanılamaz.

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

Yöntemler

YöntemDönüş türüKısa açıklama
setDialogAction(dialogAction)ChatActionResponseİletişim kutusu işlemini, iletişim kutusuyla ilgili bir etkinliğe ayarlar.
setResponseType(responseType)ChatActionResponseChat uygulaması yanıtının türü.
setUpdatedWidget(updatedWidget)ChatActionResponseBir widget için otomatik tamamlama seçenekleri sunmak üzere kullanılan güncellenmiş widget'ı ayarlar.
setUrl(url)ChatActionResponseKullanıcıların kimliğini doğrulaması veya yapılandırması için URL.

Ayrıntılı belgeler

setDialogAction(dialogAction)

İletişim kutusu işlemini, iletişim kutusuyla ilgili bir etkinliğe ayarlar.

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

Parametreler

AdTürAçıklama
dialogActionDialogActionAyarlanacak iletişim kutusu işlemi.

Return

ChatActionResponse: Zincirleme için bu nesne.


setResponseType(responseType)

Chat uygulaması yanıtının türü.

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

Parametreler

AdTürAçıklama
responseTypeResponseTypeYanıt türü.

Return

ChatActionResponse: Zincirleme için bu nesne.


setUpdatedWidget(updatedWidget)

Bir widget için otomatik tamamlama seçenekleri sunmak üzere kullanılan güncellenmiş widget'ı ayarlar.

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);
. Yalnızca Google Chat uygulamalarında kullanılabilir. Google Workspace eklentileriyle kullanılamaz.

Parametreler

AdTürAçıklama
updatedWidgetUpdatedWidgetAyarlanacak güncellenmiş widget.

Return

ChatActionResponse: Zincirleme için bu nesne.


setUrl(url)

Kullanıcıların kimliğini doğrulaması veya yapılandırması için URL. Yalnızca REQUEST_CONFIG yanıtı için türü.

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

Parametreler

AdTürAçıklama
urlStringGönderilecek URL.

Return

ChatActionResponse: Zincirleme için bu nesne.