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();
तरीके
| तरीका | रिटर्न टाइप | संक्षिप्त विवरण |
|---|---|---|
add | Chat | मैसेज का कार्ड फ़ील्ड सेट करता है. |
build() | Chat | कार्रवाई के मौजूदा जवाब को बनाता है और उसकी पुष्टि करता है. |
set | Chat | मैसेज का कार्रवाई का जवाब फ़ील्ड सेट करता है. |
set | Chat | चैट मैसेज का टेक्स्ट सेट करता है. |
ज़्यादा जानकारी वाला दस्तावेज़
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();
पैरामीटर
| नाम | टाइप | ब्यौरा |
|---|---|---|
card | Card | इस्तेमाल किया जाने वाला Card. |
वापसी का टिकट
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();
पैरामीटर
| नाम | टाइप | ब्यौरा |
|---|---|---|
action | Chat | इस्तेमाल किया जाने वाला Chat. |
वापसी का टिकट
ChatResponseBuilder — चेन बनाने के लिए यह ऑब्जेक्ट.
setText(text)
चैट मैसेज का टेक्स्ट सेट करता है.
const chatResponse = CardService.newChatResponseBuilder().setText('Example text').build();
पैरामीटर
| नाम | टाइप | ब्यौरा |
|---|---|---|
text | String | इस्तेमाल किया जाने वाला टेक्स्ट. |
वापसी का टिकट
ChatResponseBuilder — चेन बनाने के लिए यह ऑब्जेक्ट.