Class ChatResponseBuilder

ChatResponseBuilder

ChatResponse ऑब्जेक्ट बनाने वाला बिल्डर.

यह सुविधा सिर्फ़ Google Chat ऐप्लिकेशन के लिए उपलब्ध है. यह सुविधा, Google Workspace के ऐड-ऑन के लिए उपलब्ध नहीं है.

const cardSection = CardService.newCardSection();
cardSection.addWidget(
    CardService.newTextParagraph().setText('This is a text paragraph widget.'),
);

const card = CardService.newCardBuilder()
                 .setName('Card name')
                 .setHeader(CardService.newCardHeader().setTitle('Card title'))
                 .addSection(cardSection)
                 .build();

const cardWithId =
    CardService.newCardWithId().setCardId('card_id').setCard(card);

const chatResponse = CardService.newChatResponseBuilder()
                         .addCardsV2(cardWithId)
                         .setText('Example text')
                         .build();

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
addCardsV2(cardWithId)ChatResponseBuilderमैसेज का कार्ड फ़ील्ड सेट करता है.
build()ChatResponseकार्रवाई के मौजूदा जवाब को बनाता है और उसकी पुष्टि करता है.
setActionResponse(actionResponse)ChatResponseBuilderमैसेज का कार्रवाई का जवाब फ़ील्ड सेट करता है.
setText(text)ChatResponseBuilderचैट मैसेज का टेक्स्ट सेट करता है.

ज़्यादा जानकारी वाला दस्तावेज़

addCardsV2(cardWithId)

मैसेज का कार्ड फ़ील्ड सेट करता है. इसका इस्तेमाल, Google Chat के मैसेज में कार्ड भेजने के लिए किया जाता है. हर कार्ड, यूनीक आईडी से जुड़ा होता है. इसलिए, CardWithId ऑब्जेक्ट बनाया जाना चाहिए और इस तरीके के साथ इसका इस्तेमाल किया जाना चाहिए.

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

पैरामीटर

नामटाइपब्यौरा
cardWithIdCardWithIdइस्तेमाल किया जाने वाला CardWithId.

वापसी का टिकट

ChatResponseBuilder — चेन बनाने के लिए यह ऑब्जेक्ट.


build()

कार्रवाई के मौजूदा जवाब को बनाता है और उसकी पुष्टि करता है.

वापसी का टिकट

ChatResponse — पुष्टि किया गया ChatResponse.


setActionResponse(actionResponse)

मैसेज का कार्रवाई का जवाब फ़ील्ड सेट करता है.

// Build the card.
const card = CardService.newCardBuilder()
                 .setHeader(CardService.newCardHeader().setTitle('card title'))
                 .build();

// Creates the dialog.
const dialog = CardService.newDialog().setBody(card);

// Creates the dialog action.
const dialogAction = CardService.newDialogAction().setDialog(dialog);

// Creates the action response and sets the type to DIALOG.
const actionResponse = CardService.newChatActionResponse()
                           .setDialogAction(dialogAction)
                           .setResponseType(CardService.Type.DIALOG);

// Creates the Chat response and sets the action response.
const chatResponse = CardService.newChatResponseBuilder()
                         .setActionResponse(actionResponse)
                         .build();

पैरामीटर

नामटाइपब्यौरा
actionResponseChatActionResponseइस्तेमाल किया जाने वाला ChatActionResponse.

वापसी का टिकट

ChatResponseBuilder — चेन बनाने के लिए यह ऑब्जेक्ट.


setText(text)

चैट मैसेज का टेक्स्ट सेट करता है.

const chatResponse =
    CardService.newChatResponseBuilder().setText('Example text').build();

पैरामीटर

नामटाइपब्यौरा
textStringइस्तेमाल किया जाने वाला टेक्स्ट.

वापसी का टिकट

ChatResponseBuilder — चेन बनाने के लिए यह ऑब्जेक्ट.