diff --git a/chat/advanced-service/Main.gs b/chat/advanced-service/Main.gs
index ab1b2fab1..01ad85d41 100644
--- a/chat/advanced-service/Main.gs
+++ b/chat/advanced-service/Main.gs
@@ -91,41 +91,47 @@ function createMessageAppCred() {
// TODO(developer): Replace SPACE_NAME here.
const parent = 'spaces/SPACE_NAME';
const message = {
- text: 'Hello with app credential!'
- };
- const parameters = {};
-
- // Make the request
- const response = Chat.Spaces.Messages.create(
- message, parent, parameters, getHeaderWithAppCredentials()
- );
-
- // Handle the response
- console.log(response);
-}
-// [END chat_create_message_app_cred]
-
-// [START chat_create_message_app_cred_with_cards]
-/**
- * This sample shows how to create message with a card attached with app credential
- *
- * It relies on the OAuth2 scope 'https://www.googleapis.com/auth/chat.bot'
- * used by service accounts.
- */
-function createMessageAppCredWithCards() {
- // Initialize request argument(s)
- // TODO(developer): Replace SPACE_NAME here.
- const parent = 'spaces/SPACE_NAME';
- const message = {
- text: 'Hello with app credential!',
- cardsV2: [{
- cardId: 'card-id',
- card: {
- header: {
- title: 'And with a card!',
+ text: '👋🌎 Hello world! I created this message by calling ' +
+ 'the Chat API\'s `messages.create()` method.',
+ cardsV2 : [{ card: {
+ header: {
+ title: 'About this message',
+ imageUrl: 'https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/info/default/24px.svg'
+ },
+ sections: [{
+ header: 'Contents',
+ widgets: [{ textParagraph: {
+ text: '🔡 Text which can include ' +
+ 'hyperlinks 🔗, emojis 😄🎉, and @mentions 🗣️.'
+ }}, { textParagraph: {
+ text: '🖼️ A card to display visual elements' +
+ 'and request information such as text 🔤, ' +
+ 'dates and times 📅, and selections ☑️.'
+ }}, { textParagraph: {
+ text: '👉🔘 An accessory widget which adds ' +
+ 'a button to the bottom of a message.'
+ }}
+ ]}, {
+ header: "What's next",
+ collapsible: true,
+ widgets: [{ textParagraph: {
+ text: "❤️ Add a reaction."
+ }}, { textParagraph: {
+ text: "🔄 Update " +
+ "or ❌ delete " +
+ "the message."
+ }
+ }]
}
- }
- }]
+ ]
+ }}],
+ accessoryWidgets: [{ buttonList: { buttons: [{
+ text: 'View documentation',
+ icon: { materialIcon: { name: 'link' }},
+ onClick: { openLink: {
+ url: 'https://developers.google.com/workspace/chat/create-messages'
+ }}
+ }]}}]
};
const parameters = {};
@@ -137,7 +143,7 @@ function createMessageAppCredWithCards() {
// Handle the response
console.log(response);
}
-// [END chat_create_message_app_cred_with_cards]
+// [END chat_create_message_app_cred]
// [START chat_create_message_user_cred]
/**
@@ -151,7 +157,14 @@ function createMessageUserCred() {
// TODO(developer): Replace SPACE_NAME here.
const parent = 'spaces/SPACE_NAME';
const message = {
- text: 'Hello with user credential!'
+ text: '👋🌎 Hello world!' +
+ 'Text messages can contain things like:\n\n' +
+ '* Hyperlinks 🔗\n' +
+ '* Emojis 😄🎉\n' +
+ '* Mentions of other Chat users `@` \n\n' +
+ 'For details, see the ' +
+ '.'
};
// Make the request