Xây dựng ứng dụng Google Chat phía sau tường lửa bằng Pub/Sub

Trang này giải thích cách tạo một ứng dụng Chat bằng Pub/Sub. Loại Cấu trúc của ứng dụng Chat rất hữu ích nếu tổ chức của bạn có tường lửa, tường lửa có thể ngăn Chat gửi tin nhắn đến ứng dụng Chat hoặc nếu Ứng dụng Chat sử dụng API Sự kiện của Google Workspace. Tuy nhiên, việc này có những hạn chế sau đây do thực tế là Các ứng dụng nhắn tin chỉ có thể gửi và nhận thông báo không đồng bộ:

  • Không thể sử dụng hộp thoại trong tin nhắn. Thay vào đó, hãy sử dụng thông báo thẻ.
  • Không thể cập nhật từng thẻ bằng phản hồi đồng bộ. Thay vào đó, hãy cập nhật toàn bộ thư bằng cách gọi lệnh patch .

Sơ đồ dưới đây mô tả cấu trúc của một Ứng dụng Chat được xây dựng bằng Pub/Sub:

Cấu trúc của ứng dụng Chat được triển khai bằng Pub/Sub.

Trong biểu đồ trên, một người dùng tương tác với Pub/Sub Ứng dụng Chat có luồng thông tin sau đây:

  1. Người dùng gửi tin nhắn trong Chat tới ứng dụng Chat, trong tin nhắn trực tiếp hoặc trong Phòng Chat hoặc một sự kiện diễn ra trong phòng Chat mà ứng dụng Chat có gói thuê bao.

  2. Chat gửi tin nhắn đến một chủ đề Pub/Sub.

  3. Một máy chủ ứng dụng, có thể là một đám mây hoặc hệ thống tại chỗ chứa logic ứng dụng Chat, đăng ký Chủ đề Pub/Sub để nhận thư qua tường lửa.

  4. Nếu muốn, ứng dụng Chat có thể gọi API Chat để đăng thông báo một cách không đồng bộ hoặc thực hiện các thao tác khác các toán tử.

Điều kiện tiên quyết

Java

Python

Node.js

  • Doanh nghiệp Tài khoản Google Workspace có quyền truy cập vào Google Chat.
  • Một dự án trên Google Cloud đã bật tính năng thanh toán. Cách kiểm tra để đảm bảo rằng một dự án hiện tại đã bật tính năng thanh toán: hãy xem phần Xác minh trạng thái thanh toán của dự án. Để tạo dự án và thiết lập thông tin thanh toán, hãy xem Tạo một dự án trên Google Cloud.
  • Node.js 14 trở lên
  • npm công cụ quản lý gói
  • Một dự án Node.js đã khởi tạo. Để khởi chạy một dự án mới, hãy tạo và chuyển sang một thư mục mới, sau đó chạy lệnh sau trong giao diện dòng lệnh:
    npm init
    

Thiết lập môi trường

Trước khi sử dụng các API của Google, bạn cần bật các API này trong một dự án trên Google Cloud. Bạn có thể bật một hoặc nhiều API trong một dự án Google Cloud.
  • Trong bảng điều khiển Google Cloud, hãy bật API Google Chat và Pub/Sub API.

    Bật API

Thiết lập Pub/Sub

  1. Tạo chủ đề Pub/Sub mà API Chat có thể gửi tin nhắn. Bạn nên sử dụng một chủ đề duy nhất cho mỗi ứng dụng Chat.

  2. Cấp quyền xuất bản cho Chat cho chủ đề đó bằng cách chỉ định vai trò Nhà xuất bản Pub/Sub cho tài khoản dịch vụ:

    chat-api-push@system.gserviceaccount.com
    
  3. Tạo tài khoản dịch vụ để ứng dụng Chat uỷ quyền với Pub/Sub và Trò chuyện và lưu tệp khoá riêng tư vào thư mục đang làm việc của bạn.

  4. Tạo gói thuê bao kéo vào chủ đề.

  5. Chỉ định Vai trò người đăng ký Pub/Sub cho gói thuê bao cho tài khoản dịch vụ mà bạn đã tạo trước đó.

Viết kịch bản

Java

  1. Trong CLI, hãy cung cấp thông tin đăng nhập vào tài khoản dịch vụ:

    export GOOGLE_APPLICATION_CREDENTIALS=SERVICE_ACCOUNT_FILE_PATH
    
  2. Trong CLI, hãy cung cấp mã dự án trên Google Cloud:

    export PROJECT_ID=PROJECT_ID
    
  3. Trong CLI, hãy cung cấp mã nhận dạng gói thuê bao cho gói thuê bao Pub/Sub mà bạn đã tạo trước đây:

    export SUBSCRIPTION_ID=SUBSCRIPTION_ID
    
  4. Trong thư mục đang làm việc, hãy tạo một tệp có tên pom.xml.

  5. Trong tệp pom.xml, hãy dán mã sau:

    java/pub-sub-app/pom.xml
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
    
      <groupId>com.google.chat</groupId>
      <artifactId>pub-sub-app</artifactId>
      <version>0.1.0</version>
    
      <name>pub-sub-app-java</name>
    
      <properties>
        <maven.compiler.release>21</maven.compiler.release>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
      </properties>
    
      <dependencies>
        <!-- Google Chat GAPIC library -->
        <dependency>
          <groupId>com.google.api.grpc</groupId>
          <artifactId>proto-google-cloud-chat-v1</artifactId>
          <version>0.8.0</version>
        </dependency>
        <dependency>
          <groupId>com.google.api</groupId>
          <artifactId>gax</artifactId>
          <version>2.48.1</version>
        </dependency>
        <dependency>
          <groupId>com.google.cloud</groupId>
          <artifactId>google-cloud-chat</artifactId>
          <version>0.1.0</version>
        </dependency>
        <!-- Google Cloud Pub/Sub library -->
        <dependency>
          <groupId>com.google.cloud</groupId>
          <artifactId>google-cloud-pubsub</artifactId>
        <version>1.125.8</version>
        </dependency>
        <!-- JSON utilities -->
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
          <version>2.14.2</version>
        </dependency>
      </dependencies>
    
    </project>
  6. Trong thư mục đang hoạt động, hãy tạo cấu trúc thư mục src/main/java.

  7. Trong thư mục src/main/java, hãy tạo một tệp có tên Main.java.

  8. Trong Main.java, hãy dán mã sau:

    java/pub-sub-app/src/main/java/Main.java
    import com.fasterxml.jackson.databind.JsonNode;
    import com.fasterxml.jackson.databind.ObjectMapper;
    import com.google.api.gax.core.FixedCredentialsProvider;
    import com.google.auth.oauth2.GoogleCredentials;
    import com.google.chat.v1.ChatServiceClient;
    import com.google.chat.v1.ChatServiceSettings;
    import com.google.chat.v1.CreateMessageRequest;
    import com.google.chat.v1.CreateMessageRequest.MessageReplyOption;
    import com.google.chat.v1.Message;
    import com.google.chat.v1.Thread;
    import com.google.cloud.pubsub.v1.AckReplyConsumer;
    import com.google.cloud.pubsub.v1.MessageReceiver;
    import com.google.cloud.pubsub.v1.Subscriber;
    import com.google.pubsub.v1.ProjectSubscriptionName;
    import com.google.pubsub.v1.PubsubMessage;
    import java.io.FileInputStream;
    import java.util.Collections;
    
    public class Main {
    
      public static final String PROJECT_ID_ENV_PROPERTY = "PROJECT_ID";
      public static final String SUBSCRIPTION_ID_ENV_PROPERTY = "SUBSCRIPTION_ID";
      public static final String CREDENTIALS_PATH_ENV_PROPERTY = "GOOGLE_APPLICATION_CREDENTIALS";
    
      public static void main(String[] args) throws Exception {
        ProjectSubscriptionName subscriptionName =
            ProjectSubscriptionName.of(
                System.getenv(Main.PROJECT_ID_ENV_PROPERTY),
                System.getenv(Main.SUBSCRIPTION_ID_ENV_PROPERTY));
    
        // Instantiate app, which implements an asynchronous message receiver.
        EchoApp echoApp = new EchoApp();
    
        // Create a subscriber for <var>SUBSCRIPTION_ID</var> bound to the message receiver
        final Subscriber subscriber = Subscriber.newBuilder(subscriptionName, echoApp).build();
        System.out.println("Subscriber is listening to events...");
        subscriber.startAsync();
    
        // Wait for termination
        subscriber.awaitTerminated();
      }
    }
    
    /**
     * A demo app which implements {@link MessageReceiver} to receive messages. It simply echoes the
     * incoming messages.
     */
    class EchoApp implements MessageReceiver {
    
      // Path to the private key JSON file of the service account to be used for posting response
      // messages to Google Chat.
      // In this demo, we are using the same service account for authorizing with Cloud Pub/Sub to
      // receive messages and authorizing with Google Chat to post messages. If you are using
      // different service accounts, please set the path to the private key JSON file of the service
      // account used to post messages to Google Chat here.
      private static final String SERVICE_ACCOUNT_KEY_PATH =
          System.getenv(Main.CREDENTIALS_PATH_ENV_PROPERTY);
    
      // Developer code for Google Chat API scope.
      private static final String GOOGLE_CHAT_API_SCOPE = "https://www.googleapis.com/auth/chat.bot";
    
      private static final String ADDED_RESPONSE = "Thank you for adding me!";
    
      ChatServiceClient chatServiceClient;
    
      EchoApp() throws Exception {
        GoogleCredentials credential =
            GoogleCredentials.fromStream(new FileInputStream(SERVICE_ACCOUNT_KEY_PATH))
                .createScoped(Collections.singleton(GOOGLE_CHAT_API_SCOPE));
    
        // Create the ChatServiceSettings with the app credentials
        ChatServiceSettings chatServiceSettings =
            ChatServiceSettings.newBuilder()
                .setCredentialsProvider(FixedCredentialsProvider.create(credential))
                .build();
    
        // Set the Chat service client
        chatServiceClient = ChatServiceClient.create(chatServiceSettings);
      }
    
      // Called when a message is received by the subscriber.
      @Override
      public void receiveMessage(PubsubMessage pubsubMessage, AckReplyConsumer consumer) {
        System.out.println("Id : " + pubsubMessage.getMessageId());
        // Handle incoming message, then ack/nack the received message
        try {
          ObjectMapper mapper = new ObjectMapper();
          JsonNode dataJson = mapper.readTree(pubsubMessage.getData().toStringUtf8());
          System.out.println("Data : " + dataJson.toString());
          handle(dataJson);
          consumer.ack();
        } catch (Exception e) {
          System.out.println(e);
          consumer.nack();
        }
      }
    
      // Send message to Google Chat based on the type of event.
      public void handle(JsonNode eventJson) throws Exception {
        CreateMessageRequest createMessageRequest;
        switch (eventJson.get("type").asText()) {
          case "ADDED_TO_SPACE":
            // An app can also be added to a space by @mentioning it in a message. In that case, we fall
            // through to the MESSAGE case and let the app respond. If the app was added using the
            // invite flow, we just post a thank you message in the space.
            if (!eventJson.has("message")) {
              createMessageRequest =
                  CreateMessageRequest.newBuilder()
                      .setParent(eventJson.get("space").get("name").asText())
                      .setMessage(Message.newBuilder().setText(ADDED_RESPONSE).build())
                      .build();
              break;
            }
          case "MESSAGE":
            // In case of message, post the response in the same thread.
            createMessageRequest =
                CreateMessageRequest.newBuilder()
                    .setParent(eventJson.get("space").get("name").asText())
                    .setMessageReplyOption(MessageReplyOption.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD)
                    .setMessage(
                        Message.newBuilder()
                            .setText(
                                "You said: `" + eventJson.get("message").get("text").asText() + "`")
                            .setThread(
                                Thread.newBuilder()
                                    .setName(
                                        eventJson.get("message").get("thread").get("name").asText())
                                    .build())
                            .build())
                    .build();
            break;
          case "REMOVED_FROM_SPACE":
          default:
            // Do nothing
            return;
        }
    
        // Post the response to Google Chat.
        chatServiceClient.createMessage(createMessageRequest);
      }
    }

Python

  1. Trong CLI, hãy cung cấp thông tin đăng nhập vào tài khoản dịch vụ:

    export GOOGLE_APPLICATION_CREDENTIALS=SERVICE_ACCOUNT_FILE_PATH
    
  2. Trong CLI, hãy cung cấp mã dự án trên Google Cloud:

    export PROJECT_ID=PROJECT_ID
    
  3. Trong CLI, hãy cung cấp mã nhận dạng gói thuê bao cho gói thuê bao Pub/Sub mà bạn đã tạo trước đây:

    export SUBSCRIPTION_ID=SUBSCRIPTION_ID
    
  4. Trong thư mục đang làm việc, hãy tạo một tệp có tên requirements.txt.

  5. Trong tệp requirements.txt, hãy dán mã sau:

    python/pub-sub-app/requirements.txt
    google-cloud-pubsub>=2.23.0
    google-apps-chat==0.1.9
    
  6. Trong thư mục đang làm việc, hãy tạo một tệp có tên app.py.

  7. Trong app.py, hãy dán mã sau:

    python/pub-sub-app/app.py
    import json
    import logging
    import os
    import sys
    import time
    from google.apps import chat_v1 as google_chat
    from google.cloud import pubsub_v1
    from google.oauth2.service_account import Credentials
    
    
    def receive_messages():
      """Receives messages from a pull subscription."""
    
      scopes = ['https://www.googleapis.com/auth/chat.bot']
      service_account_key_path = os.environ.get(
        'GOOGLE_APPLICATION_CREDENTIALS')
      creds = Credentials.from_service_account_file(
        service_account_key_path)
      chat = google_chat.ChatServiceClient(
        credentials = creds,
        client_options = {
          "scopes": scopes
        })
    
      project_id = os.environ.get('PROJECT_ID')
      subscription_id = os.environ.get('SUBSCRIPTION_ID')
      subscriber = pubsub_v1.SubscriberClient()
      subscription_path = subscriber.subscription_path(
          project_id, subscription_id)
    
      # Handle incoming message, then ack/nack the received message
      def callback(message):
        event = json.loads(message.data)
        logging.info('Data : %s', event)
        space_name = event['space']['name']
    
        # Post the response to Google Chat.
        request = format_request(event)
        if request is not None:
          chat.create_message(request)
    
        # Ack the message.
        message.ack()
    
      subscriber.subscribe(subscription_path, callback = callback)
      logging.info('Listening for messages on %s', subscription_path)
    
      # Keep main thread from exiting while waiting for messages
      while True:
        time.sleep(60)
    
    
    def format_request(event):
      """Send message to Google Chat based on the type of event.
      Args:
        event: A dictionary with the event data.
      """
      space_name = event['space']['name']
      event_type = event['type']
    
      # If the app was removed, we don't respond.
      if event['type'] == 'REMOVED_FROM_SPACE':
        logging.info('App removed rom space %s', space_name)
        return
      elif event_type == 'ADDED_TO_SPACE' and 'message' not in event:
        # An app can also be added to a space by @mentioning it in a
        # message. In that case, we fall through to the message case
        # and let the app respond. If the app was added using the
        # invite flow, we just post a thank you message in the space.
        return google_chat.CreateMessageRequest(
            parent = space_name,
            message = {
              'text': 'Thank you for adding me!'
            }
        )
      elif event_type in ['ADDED_TO_SPACE', 'MESSAGE']:
        # In case of message, post the response in the same thread.
        return google_chat.CreateMessageRequest(
            parent = space_name,
            message_reply_option = google_chat.CreateMessageRequest.MessageReplyOption.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
            message = {
              'text': 'You said: `' + event['message']['text'] + '`',
              'thread': {
                'name': event['message']['thread']['name']
              }
            }
        )
    
    
    if __name__ == '__main__':
      if 'PROJECT_ID' not in os.environ:
        logging.error('Missing PROJECT_ID env var.')
        sys.exit(1)
    
      if 'SUBSCRIPTION_ID' not in os.environ:
        logging.error('Missing SUBSCRIPTION_ID env var.')
        sys.exit(1)
    
      if 'GOOGLE_APPLICATION_CREDENTIALS' not in os.environ:
        logging.error('Missing GOOGLE_APPLICATION_CREDENTIALS env var.')
        sys.exit(1)
    
      logging.basicConfig(
          level=logging.INFO,
          style='{',
          format='{levelname:.1}{asctime} {filename}:{lineno}] {message}')
      receive_messages()
    

Node.js

  1. Trong CLI, hãy cung cấp thông tin đăng nhập vào tài khoản dịch vụ:

    export GOOGLE_APPLICATION_CREDENTIALS=SERVICE_ACCOUNT_FILE_PATH
    
  2. Trong CLI, hãy cung cấp mã dự án trên Google Cloud:

    export PROJECT_ID=PROJECT_ID
    
  3. Trong CLI, hãy cung cấp mã nhận dạng gói thuê bao cho gói thuê bao Pub/Sub mà bạn đã tạo trước đây:

    export SUBSCRIPTION_ID=SUBSCRIPTION_ID
    
  4. Trong thư mục đang làm việc, hãy tạo một tệp có tên package.json.

  5. Trong tệp package.json, hãy dán mã sau:

    node/pub-sub-app/package.json
    {
      "name": "pub-sub-app",
      "version": "1.0.0",
      "description": "Google Chat App that listens for messages via Cloud Pub/Sub",
      "main": "index.js",
      "scripts": {
        "start": "node index.js",
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "dependencies": {
        "@google-apps/chat": "^0.4.0",
        "@google-cloud/pubsub": "^4.5.0"
      },
      "license": "Apache-2.0"
    }
    
  6. Trong thư mục đang làm việc, hãy tạo một tệp có tên index.js.

  7. Trong index.js, hãy dán mã sau:

    node/pub-sub-app/index.js
    const {ChatServiceClient} = require('@google-apps/chat');
    const {MessageReplyOption} = require('@google-apps/chat').protos.google.chat.v1.CreateMessageRequest;
    const {PubSub} = require('@google-cloud/pubsub');
    const {SubscriberClient} = require('@google-cloud/pubsub/build/src/v1');
    
    // Receives messages from a pull subscription.
    function receiveMessages() {
      const chat = new ChatServiceClient({
        keyFile: process.env.GOOGLE_APPLICATION_CREDENTIALS,
        scopes: ['https://www.googleapis.com/auth/chat.bot'],
      });
    
      const subscriptionPath = new SubscriberClient()
        .subscriptionPath(process.env.PROJECT_ID, process.env.SUBSCRIPTION_ID)
      const subscription = new PubSub()
        .subscription(subscriptionPath);
    
      // Handle incoming message, then ack/nack the received message
      const messageHandler = message => {
        console.log(`Id : ${message.id}`);
        const event = JSON.parse(message.data);
        console.log(`Data : ${JSON.stringify(event)}`);
    
        // Post the response to Google Chat.
        const request = formatRequest(event);
        if (request != null) {
          chat.createMessage(request);
        }
    
        // Ack the message.
        message.ack();
      }
    
      subscription.on('message', messageHandler);
      console.log(`Listening for messages on ${subscriptionPath}`);
    
      // Keep main thread from exiting while waiting for messages
      setTimeout(() => {
        subscription.removeListener('message', messageHandler);
        console.log(`Stopped listening for messages.`);
      }, 60 * 1000);
    }
    
    // Send message to Google Chat based on the type of event
    function formatRequest(event) {
      const spaceName = event.space.name;
      const eventType = event.type;
    
      // If the app was removed, we don't respond.
      if (event.type == 'REMOVED_FROM_SPACE') {
        console.log(`App removed rom space ${spaceName}`);
        return null;
      } else if (eventType == 'ADDED_TO_SPACE' && !eventType.message) {
        // An app can also be added to a space by @mentioning it in a
        // message. In that case, we fall through to the message case
        // and let the app respond. If the app was added using the
        // invite flow, we just post a thank you message in the space.
        return {
          parent: spaceName,
          message: { text: 'Thank you for adding me!' }
        };
      } else if (eventType == 'ADDED_TO_SPACE' || eventType == 'MESSAGE') {
        // In case of message, post the response in the same thread.
        return {
          parent: spaceName,
          messageReplyOption: MessageReplyOption.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
          message: {
            text: 'You said: `' + event.message.text + '`',
            thread: { name: event.message.thread.name }
          }
        };
      }
    }
    
    if (!process.env.PROJECT_ID) {
      console.log('Missing PROJECT_ID env var.');
      process.exit(1);
    }
    if (!process.env.SUBSCRIPTION_ID) {
      console.log('Missing SUBSCRIPTION_ID env var.');
      process.exit(1);
    }
    if (!process.env.GOOGLE_APPLICATION_CREDENTIALS) {
      console.log('Missing GOOGLE_APPLICATION_CREDENTIALS env var.');
      process.exit(1);
    }
    
    receiveMessages();
    

Xuất bản ứng dụng lên Chat

  1. Trong bảng điều khiển Google Cloud, hãy chuyển đến phần Trình đơn &gt; API và Dịch vụ &gt; API đã bật và Dịch vụ &gt; API Google Chat &gt; Cấu hình.

    Chuyển đến mục Cấu hình

  2. Định cấu hình ứng dụng Chat cho Pub/Sub:

    1. Trong Tên ứng dụng, hãy nhập Quickstart App.
    2. Trong URL hình đại diện, hãy nhập https://developers.google.com/chat/images/quickstart-app-avatar.png.
    3. Trong phần Mô tả, hãy nhập Quickstart app.
    4. Trong phần Chức năng, hãy chọn Nhận tin nhắn 1:1Tham gia các không gian và cuộc trò chuyện nhóm.
    5. Trong phần Connection settings (Cài đặt kết nối), hãy chọn Cloud Pub/Sub rồi dán tên của chủ đề Pub/Sub mà bạn đã tạo trước đó.
    6. Trong phần Chế độ hiển thị, hãy chọn Cung cấp ứng dụng Google Chat này cho những người và nhóm cụ thể trong miền rồi nhập địa chỉ email của bạn.
    7. Trong Logs (Nhật ký), hãy chọn Log lỗi to Logging (Ghi nhật ký vào nhật ký).
  3. Nhấp vào Lưu.

Ứng dụng này đã sẵn sàng nhận và trả lời tin nhắn trên Chat.

Chạy tập lệnh

Trong CLI, hãy chuyển sang thư mục đang làm việc của bạn và chạy tập lệnh:

Java

mvn compile exec:java -Dexec.mainClass=Main

Python

python -m venv env
source env/bin/activate
pip install -r requirements.txt -U
python app.py

Node.js

npm install
npm start

Khi bạn chạy mã, ứng dụng sẽ bắt đầu nghe các thông báo đã đăng chủ đề Pub/Sub.

Kiểm thử ứng dụng Chat

Để kiểm thử ứng dụng Chat, hãy mở một không gian nhắn tin trực tiếp bằng ứng dụng Chat rồi gửi tin nhắn:

  1. Mở Google Chat bằng tài khoản Google Workspace mà bạn khi bạn tự thêm chính mình làm người kiểm tra đáng tin cậy.

    Truy cập Google Chat

  2. Nhấp vào Cuộc trò chuyện mới.
  3. Trong trường Thêm 1 hoặc nhiều người, nhập tên của Ứng dụng Chat.
  4. Chọn ứng dụng Chat của bạn trong kết quả. Người trực tiếp tin nhắn sẽ mở ra.

  5. Trong tin nhắn trực tiếp mới với ứng dụng, hãy nhập Hello rồi nhấn enter.

Để thêm người kiểm tra đáng tin cậy và tìm hiểu thêm về cách kiểm thử các tính năng tương tác, hãy xem Kiểm thử các tính năng tương tác cho Ứng dụng Google Chat.

Khắc phục sự cố

Khi một ứng dụng Google Chat hoặc card trả về một lỗi, thì phương thức Giao diện Chat hiển thị một thông báo với nội dung "Đã xảy ra lỗi". hoặc "Không thể xử lý yêu cầu của bạn". Đôi khi, giao diện người dùng của Chat không hiện thông báo lỗi nào ngoài ứng dụng Chat hoặc thẻ tạo ra kết quả không mong muốn; ví dụ: thông báo thẻ có thể không xuất hiện.

Mặc dù thông báo lỗi có thể không xuất hiện trong giao diện người dùng Chat, thông báo lỗi mô tả và dữ liệu nhật ký luôn có sẵn để giúp bạn sửa lỗi khi tính năng ghi nhật ký lỗi cho các ứng dụng trong Chat được bật. Để được trợ giúp xem, gỡ lỗi và sửa lỗi, hãy xem Khắc phục lỗi và khắc phục lỗi của Google Chat.

Dọn dẹp

Để tránh bị tính phí vào tài khoản Google Cloud của bạn cho tài nguyên được sử dụng trong hướng dẫn này, chúng tôi khuyên bạn nên xóa Dự án trên đám mây.

  1. Trong bảng điều khiển Google Cloud, hãy chuyển đến trang Quản lý tài nguyên. Nhấp chuột Thực đơn &gt; IAM và Quản trị viên &gt; Quản lý tài nguyên.

    Chuyển đến Trình quản lý tài nguyên

  2. Trong danh sách dự án, hãy chọn dự án mà bạn muốn xoá rồi nhấp vào Xoá .
  3. Trong hộp thoại, hãy nhập mã dự án rồi nhấp vào Tắt để xoá dự án.