إرسال رسالة باستخدام Google Chat API

يشرح هذا الدليل كيفية استخدام طريقة create() في مورد Message من Google Chat API لتنفيذ أي مما يلي:

  • إرسال رسائل تحتوي على نص وبطاقات وتطبيقات مصغّرة تفاعلية
  • إرسال رسائل بشكل خاص إلى مستخدم محدّد في Chat
  • بدء سلسلة رسائل أو الردّ عليها
  • يمكنك تسمية رسالة لتتمكّن من تحديدها في طلبات Chat API الأخرى.

الحد الأقصى لحجم الرسالة (بما في ذلك أي نص أو بطاقات) هو 32,000 بايت. لإرسال رسالة تتجاوز هذا الحجم، يجب أن يرسل تطبيق Chat رسائل متعددة بدلاً من ذلك.

بالإضافة إلى استدعاء Chat API لإنشاء الرسائل، يمكن لتطبيقات Chat إنشاء الرسائل وإرسالها للرد على تفاعلات المستخدمين، مثل نشر رسالة ترحيب بعد أن يضيف المستخدم تطبيق Chat إلى مساحة. عند الردّ على التفاعلات، يمكن لتطبيقات Chat استخدام أنواع أخرى من ميزات المراسلة، بما في ذلك مربّعات الحوار التفاعلية وواجهات معاينة الروابط. للردّ على مستخدم، يعرض تطبيق Chat الرسالة بشكل متزامن بدون طلب Chat API. للتعرّف على كيفية إرسال رسائل للردّ على التفاعلات، يُرجى الاطّلاع على المقالة تلقّي التفاعلات والردّ عليها باستخدام تطبيق Google Chat.

كيفية عرض Chat للرسائل التي تم إنشاؤها باستخدام Chat API ونسبها إلى مصدرها

يمكنك استدعاء طريقة create() باستخدام مصادقة التطبيق ومصادقة المستخدم. ينسب Chat مُرسِل الرسالة بشكل مختلف حسب نوع المصادقة التي تستخدمها.

عند المصادقة بصفتك تطبيق Chat، يرسل تطبيق Chat الرسالة.

استدعاء طريقة create()‎ مع مصادقة التطبيق
الشكل 1: من خلال مصادقة التطبيق، يرسل تطبيق Chat الرسالة. للإشارة إلى أنّ المُرسِل ليس شخصًا، يعرض Chat الرمز App بجانب اسمه.

عند المصادقة كمستخدم، يرسل تطبيق Chat الرسالة نيابةً عن المستخدم. ينسب Chat أيضًا تطبيق Chat إلى الرسالة من خلال عرض اسمه.

استدعاء الإجراء create()‎ مع مصادقة المستخدم
الشكل 2: من خلال مصادقة المستخدم، يرسل المستخدم الرسالة، ويعرض Chat اسم تطبيق Chat بجانب اسم المستخدم.

يحدّد نوع المصادقة أيضًا ميزات المراسلة والواجهات التي يمكنك تضمينها في الرسالة. من خلال مصادقة التطبيقات، يمكن لتطبيقات Chat إرسال رسائل تحتوي على نص منسّق وواجهات مستندة إلى البطاقات وتطبيقات مصغّرة تفاعلية. باستخدام مصادقة المستخدم، يمكنك إرسال رسائل نصية أو إنشاء رسائل باستخدام البطاقات، كما هو موضّح في إنشاء البطاقات التفاعلية وتعديلها.

لمزيد من المعلومات عن ميزات المراسلة المتاحة في Chat API، يُرجى الاطّلاع على نظرة عامة على رسائل Google Chat.

يوضّح هذا الدليل كيفية استخدام أيّ من نوعَي المصادقة لإرسال رسالة باستخدام Chat API.

المتطلبات الأساسية

Node.js

Python

جافا

برمجة التطبيقات

إرسال رسالة بصفتك تطبيق Chat

يوضّح هذا القسم كيفية إرسال رسائل تحتوي على نصوص وبطاقات وعناصر واجهة مستخدم تفاعلية باستخدام مصادقة التطبيق.

تم إرسال الرسالة باستخدام مصادقة التطبيق
الشكل 4. يرسل تطبيق Chat رسالة تحتوي على نص وبطاقة وزر ملحق.

لاستدعاء الطريقة CreateMessage() باستخدام مصادقة التطبيق، يجب تحديد الحقول التالية في الطلب:

  • نطاق التفويض chat.bot
  • مورد Space الذي تريد نشر الرسالة فيه يجب أن يكون تطبيق Chat عضوًا في المساحة.
  • مورد Message المطلوب إنشاؤه لتحديد محتوى الرسالة، يمكنك تضمين نص منسَّق (text) أو واجهة بطاقة واحدة أو أكثر (cardsV2) أو كليهما.

يمكنك اختياريًا تضمين ما يلي:

يوضّح الرمز التالي مثالاً على كيفية إرسال تطبيق Chat لرسالة منشورة كتطبيق Chat تحتوي على نص وبطاقة وزر قابل للنقر في أسفل الرسالة:

Node.js

chat/client-libraries/cloud/create-message-app-cred.js
import {createClientWithAppCredentials} from './authentication-utils.js';

// This sample shows how to create message with app credential
async function main() {
  // Create a client
  const chatClient = createClientWithAppCredentials();

  // Initialize request argument(s)
  const request = {
    // Replace SPACE_NAME here.
    parent: 'spaces/SPACE_NAME',
    message: {
      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:
                        '🔡 <b>Text</b> which can include ' +
                        'hyperlinks 🔗, emojis 😄🎉, and @mentions 🗣️.',
                    },
                  },
                  {
                    textParagraph: {
                      text:
                        '🖼️ A <b>card</b> to display visual elements' +
                        'and request information such as text 🔤, ' +
                        'dates and times 📅, and selections ☑️.',
                    },
                  },
                  {
                    textParagraph: {
                      text:
                        '👉🔘 An <b>accessory widget</b> which adds ' +
                        'a button to the bottom of a message.',
                    },
                  },
                ],
              },
              {
                header: "What's next",
                collapsible: true,
                widgets: [
                  {
                    textParagraph: {
                      text: "❤️ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.reactions/create'>Add a reaction</a>.",
                    },
                  },
                  {
                    textParagraph: {
                      text:
                        "🔄 <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/patch'>Update</a> " +
                        "or ❌ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/delete'>delete</a> " +
                        'the message.',
                    },
                  },
                ],
              },
            ],
          },
        },
      ],
      accessoryWidgets: [
        {
          buttonList: {
            buttons: [
              {
                text: 'View documentation',
                icon: {materialIcon: {name: 'link'}},
                onClick: {
                  openLink: {
                    url: 'https://developers.google.com/workspace/chat/create-messages',
                  },
                },
              },
            ],
          },
        },
      ],
    },
  };

  // Make the request
  const response = await chatClient.createMessage(request);

  // Handle the response
  console.log(response);
}

await main();

Python

chat/client-libraries/cloud/create_message_app_cred.py
from authentication_utils import create_client_with_app_credentials
from google.apps import chat_v1 as google_chat

# This sample shows how to create message with app credential
def create_message_with_app_cred():
    # Create a client
    client = create_client_with_app_credentials()

    # Initialize request argument(s)
    request = google_chat.CreateMessageRequest(
        # Replace SPACE_NAME here.
        parent = "spaces/SPACE_NAME",
        message = {
            "text": '👋🌎 Hello world! I created this message by calling ' +
                    'the Chat API\'s `messages.create()` method.',
            "cards_v2" : [{ "card": {
                "header": {
                    "title": 'About this message',
                    "image_url": 'https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/info/default/24px.svg'
                },
                "sections": [{
                    "header": "Contents",
                    "widgets": [{ "text_paragraph": {
                            "text": '🔡 <b>Text</b> which can include ' +
                                    'hyperlinks 🔗, emojis 😄🎉, and @mentions 🗣️.'
                        }}, { "text_paragraph": {
                            "text": '🖼️ A <b>card</b> to display visual elements' +
                                    'and request information such as text 🔤, ' +
                                    'dates and times 📅, and selections ☑️.'
                        }}, { "text_paragraph": {
                            "text": '👉🔘 An <b>accessory widget</b> which adds ' +
                                    'a button to the bottom of a message.'
                        }}
                    ]}, {
                        "header": "What's next",
                        "collapsible": True,
                        "widgets": [{ "text_paragraph": {
                                "text": "❤️ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.reactions/create'>Add a reaction</a>."
                            }}, { "text_paragraph": {
                                "text": "🔄 <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/patch'>Update</a> " +
                                        "or ❌ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/delete'>delete</a> " +
                                        "the message."
                            }
                        }]
                    }
                ]
            }}],
            "accessory_widgets": [{ "button_list": { "buttons": [{
                "text": 'View documentation',
                "icon": { "material_icon": { "name": 'link' }},
                "on_click": { "open_link": {
                    "url": 'https://developers.google.com/workspace/chat/create-messages'
                }}
            }]}}]
        }
    )

    # Make the request
    response = client.create_message(request)

    # Handle the response
    print(response)

create_message_with_app_cred()

جافا

chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/CreateMessageAppCred.java
import com.google.apps.card.v1.Button;
import com.google.apps.card.v1.ButtonList;
import com.google.apps.card.v1.Card;
import com.google.apps.card.v1.Icon;
import com.google.apps.card.v1.MaterialIcon;
import com.google.apps.card.v1.OnClick;
import com.google.apps.card.v1.OpenLink;
import com.google.apps.card.v1.TextParagraph;
import com.google.apps.card.v1.Widget;
import com.google.apps.card.v1.Card.CardHeader;
import com.google.apps.card.v1.Card.Section;
import com.google.chat.v1.AccessoryWidget;
import com.google.chat.v1.CardWithId;
import com.google.chat.v1.ChatServiceClient;
import com.google.chat.v1.CreateMessageRequest;
import com.google.chat.v1.Message;

// This sample shows how to create message with app credential.
public class CreateMessageAppCred {

  public static void main(String[] args) throws Exception {
    try (ChatServiceClient chatServiceClient =
        AuthenticationUtils.createClientWithAppCredentials()) {
      CreateMessageRequest.Builder request = CreateMessageRequest.newBuilder()
        // Replace SPACE_NAME here.
        .setParent("spaces/SPACE_NAME")
        .setMessage(Message.newBuilder()
          .setText( "👋🌎 Hello world! I created this message by calling " +
                    "the Chat API\'s `messages.create()` method.")
          .addCardsV2(CardWithId.newBuilder().setCard(Card.newBuilder()
            .setHeader(CardHeader.newBuilder()
              .setTitle("About this message")
              .setImageUrl("https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/info/default/24px.svg"))
            .addSections(Section.newBuilder()
              .setHeader("Contents")
              .addWidgets(Widget.newBuilder().setTextParagraph(TextParagraph.newBuilder().setText(
                "🔡 <b>Text</b> which can include " +
                "hyperlinks 🔗, emojis 😄🎉, and @mentions 🗣️.")))
              .addWidgets(Widget.newBuilder().setTextParagraph(TextParagraph.newBuilder().setText(
                "🖼️ A <b>card</b> to display visual elements " +
                "and request information such as text 🔤, " +
                "dates and times 📅, and selections ☑️.")))
              .addWidgets(Widget.newBuilder().setTextParagraph(TextParagraph.newBuilder().setText(
                "👉🔘 An <b>accessory widget</b> which adds " +
                "a button to the bottom of a message."))))
            .addSections(Section.newBuilder()
              .setHeader("What's next")
              .setCollapsible(true)
              .addWidgets(Widget.newBuilder().setTextParagraph(TextParagraph.newBuilder().setText(
                "❤️ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.reactions/create'>Add a reaction</a>.")))
              .addWidgets(Widget.newBuilder().setTextParagraph(TextParagraph.newBuilder().setText(
                "🔄 <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/patch'>Update</a> " +
                "or ❌ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/delete'>delete</a> " +
                "the message."))))))
          .addAccessoryWidgets(AccessoryWidget.newBuilder()
            .setButtonList(ButtonList.newBuilder()
              .addButtons(Button.newBuilder()
                .setText("View documentation")
                .setIcon(Icon.newBuilder()
                  .setMaterialIcon(MaterialIcon.newBuilder().setName("link")))
                .setOnClick(OnClick.newBuilder()
                  .setOpenLink(OpenLink.newBuilder()
                    .setUrl("https://developers.google.com/workspace/chat/create-messages")))))));
      Message response = chatServiceClient.createMessage(request.build());

      System.out.println(JsonFormat.printer().print(response));
    }
  }
}

برمجة التطبيقات

chat/advanced-service/Main.gs
/**
 * This sample shows how to create message with app credential
 *
 * It relies on the OAuth2 scope 'https://www.googleapis.com/auth/chat.bot'
 * used by service accounts.
 */
function createMessageAppCred() {
  // Initialize request argument(s)
  // TODO(developer): Replace SPACE_NAME here.
  const parent = "spaces/SPACE_NAME";
  const message = {
    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:
                      "🔡 <b>Text</b> which can include " +
                      "hyperlinks 🔗, emojis 😄🎉, and @mentions 🗣️.",
                  },
                },
                {
                  textParagraph: {
                    text:
                      "🖼️ A <b>card</b> to display visual elements" +
                      "and request information such as text 🔤, " +
                      "dates and times 📅, and selections ☑️.",
                  },
                },
                {
                  textParagraph: {
                    text:
                      "👉🔘 An <b>accessory widget</b> which adds " +
                      "a button to the bottom of a message.",
                  },
                },
              ],
            },
            {
              header: "What's next",
              collapsible: true,
              widgets: [
                {
                  textParagraph: {
                    text: "❤️ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.reactions/create'>Add a reaction</a>.",
                  },
                },
                {
                  textParagraph: {
                    text:
                      "🔄 <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/patch'>Update</a> " +
                      "or ❌ <a href='https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/delete'>delete</a> " +
                      "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 = {};

  // Make the request
  const response = Chat.Spaces.Messages.create(
    message,
    parent,
    parameters,
    getHeaderWithAppCredentials(),
  );

  // Handle the response
  console.log(response);
}

لتشغيل هذا النموذج، استبدِل SPACE_NAME بالمعرّف من حقل name الخاص بالمساحة. يمكنك الحصول على المعرّف من خلال استدعاء الطريقة ListSpaces() أو من عنوان URL الخاص بالمساحة.

إضافة تطبيقات مصغّرة تفاعلية في أسفل الرسالة

في عينة التعليمات البرمجية الأولى من هذا الدليل، تعرض رسالة تطبيق Chat زرًا قابلاً للنقر في أسفل الرسالة، يُعرف باسم عنصر واجهة مستخدم ملحق. تظهر التطبيقات المصغّرة الملحقة بعد أي نص أو بطاقات في الرسالة. يمكنك استخدام هذه التطبيقات المصغّرة لحثّ المستخدمين على التفاعل مع رسالتك بطرق متعددة، بما في ذلك ما يلي:

  • تقييم دقة الرسالة أو مدى رضاك عنها
  • الإبلاغ عن مشكلة في الرسالة أو تطبيق Chat
  • فتح رابط يؤدي إلى محتوى ذي صلة، مثل المستندات
  • إغلاق الرسائل المشابهة أو تأجيلها من تطبيق Chat لفترة زمنية محدّدة

لإضافة تطبيقات مصغّرة ملحقة، أدرِج الحقل accessoryWidgets[] في نص طلبك وحدِّد تطبيقًا مصغّرًا واحدًا أو أكثر تريد تضمينه.

تعرض الصورة التالية تطبيق Chat يُلحق رسالة نصية بعناصر واجهة مستخدم ملحقة حتى يتمكّن المستخدمون من تقييم تجربتهم مع تطبيق Chat.

تطبيق مصغّر ملحق
الشكل 5: رسالة تطبيق Chat تتضمّن نصًا وعناصر واجهة مستخدم ملحقة

يوضح ما يلي نص الطلب الذي ينشئ رسالة نصية بزرين ملحقين. عندما ينقر المستخدم على زر، تعالج الدالة المقابلة (مثل doUpvote) التفاعل:

{
  text: "Rate your experience with this Chat app.",
  accessoryWidgets: [{ buttonList: { buttons: [{
    icon: { material_icon: {
      name: "thumb_up"
    }},
    color: { red: 0, blue: 255, green: 0 },
    onClick: { action: {
      function: "doUpvote"
    }}
  }, {
    icon: { material_icon: {
      name: "thumb_down"
    }},
    color: { red: 0, blue: 255, green: 0 },
    onClick: { action: {
      function: "doDownvote"
    }}
  }]}}]
}

إرسال رسالة خاصة

يمكن لتطبيقات Chat إرسال رسائل بشكل خاص بحيث لا تظهر الرسالة إلا لمستخدم معيّن في المساحة. عندما يرسل تطبيق Chat رسالة خاصة، تعرض الرسالة تصنيفًا لإعلام المستخدم بأنّ الرسالة تظهر له فقط.

لإرسال رسالة بشكل خاص باستخدام Chat API، حدِّد الحقل privateMessageViewer في نص الطلب. لتحديد المستخدم، يمكنك ضبط القيمة على User المورد الذي يمثّل مستخدم Chat. يمكنك أيضًا استخدام حقل name في مورد User، كما هو موضّح في المثال التالي:

{
  text: "Hello private world!",
  privateMessageViewer: {
    name: "users/USER_ID"
  }
}

لاستخدام هذا النموذج، استبدِل USER_ID بمعرّف فريد للمستخدم، مثل 12345678987654321 أو hao@cymbalgroup.com. لمزيد من المعلومات حول تحديد المستخدمين، يُرجى الاطّلاع على المقالة تحديد مستخدمي Google Chat.

لإرسال رسالة بشكل خاص، يجب حذف ما يلي في طلبك:

إرسال إشعارات إلزامية أو رسائل صامتة

عندما يرسل تطبيق Chat رسالة، يمكنه استخدام أحد الخيارات التالية لإشعار المستخدمين:

  • فرض إرسال إشعار: يرسل Chat دائمًا إشعارًا فوريًا إلى المستلِمين، بغض النظر عن إعدادات الإشعارات أو حالة "عدم الإزعاج" (DND). في Chat، تؤدي الرسالة إلى ظهور النص بخط عريض وإبراز الرسالة في قائمة المستلِمين أو قائمة "الصفحة الرئيسية"، كما تعرض شارة.
  • إرسال رسالة صامتة: يمنع Chat الإشعارات الفورية للمستلِمين. في Chat، لا تؤدي الرسالة إلى ظهور النص بخط عريض أو نقله إلى أعلى قائمة المستلِمين أو قائمة "الصفحة الرئيسية"، ولا تعرض شارة. إذا كانت الرسالة الصامتة هي آخر رسالة في المحادثة، لن يظهر محتواها في المقتطف على الصفحة الرئيسية.

سواء كانت الرسائل مفروضة أو صامتة، فإنّها تتضمّن مؤشرًا مرئيًا يُعلم المستلِمين بسلوك الإشعار الخاص.

لا تتوفّر الإشعارات الإلزامية والرسائل الصامتة إلا لتطبيقات Chat التي تستخدم مصادقة التطبيق.

تنطبق القيود التالية على الإشعارات الإلزامية والرسائل الصامتة:

  • المستخدمون الخارجيون: لا تنطبق الإشعارات الإلزامية والرسائل الصامتة على المستخدمين الخارجيين (الضيوف) في المساحة. يتلقّى المستخدمون الخارجيون الإشعارات وفقًا لإعداداتهم الخاصة.
  • الإشارات: لا تتيح الرسائل الصامتة الإشارة إلى المستخدمين. إذا أضفت إشارة في رسالة صامتة، يتم التعامل معها كنص عادي.
  • سلاسل المحادثات: لا يمكنك بدء سلسلة محادثات أو الردّ عليها برسالة صامتة.
  • نوع المساحة: لا تتوفّر الإشعارات الإلزامية والرسائل الصامتة في الرسائل المباشرة أو المساحات التي يملكها مستخدمون ليس لديهم حساب على Google Workspace.
  • الإشعارات عبر البريد الإلكتروني: لا تؤدي الرسائل الصامتة إلى إرسال إشعارات عبر البريد الإلكتروني. لا تؤدي الرسائل التي يتم فرض إرسال إشعارات بشأنها إلى إرسال إشعارات عبر البريد الإلكتروني إلا إذا كانت تتضمّن أيضًا إشارة إلى مستخدم معيّن.

لفرض إشعار أو إرسال رسالة صامتة، عليك تضمين الحقل createMessageNotificationOptions في طلبك وضبط notificationType على أحد الخيارات التالية:

القيمة السلوك
NOTIFICATION_TYPE_FORCE_NOTIFY يفرض إشعارًا.
NOTIFICATION_TYPE_SILENT يتم إرسال الرسالة بدون صوت.

يعرض المثال التالي نص JSON لطلب إرسال رسالة تتضمّن إشعارًا إلزاميًا:

{
  "text": "Critical update: the server is down!",
  "createMessageNotificationOptions": {
    "notificationType": "NOTIFICATION_TYPE_FORCE_NOTIFY"
  }
}

إرسال رسالة نصية نيابةً عن مستخدم

يوضّح هذا القسم كيفية إرسال الرسائل نيابةً عن مستخدم باستخدام مصادقة المستخدم. من خلال مصادقة المستخدم، يمكنك إرسال رسائل نصية أو إنشاء رسائل باستخدام بطاقات نيابةً عن مستخدم. لمعرفة التفاصيل حول إرسال البطاقات نيابةً عن مستخدم، يُرجى الاطّلاع على مقالة إنشاء البطاقات التفاعلية وتعديلها.

تم إرسال الرسالة باستخدام مصادقة المستخدم
الشكل 3: يرسل تطبيق Chat رسالة نصية نيابةً عن مستخدم.

لاستدعاء طريقة CreateMessage() باستخدام مصادقة المستخدم، يجب تحديد الحقول التالية في الطلب:

  • نطاق تفويض يتيح مصادقة المستخدم لهذه الطريقة يستخدم النموذج التالي نطاق chat.messages.create.
  • مورد Space الذي تريد نشر الرسالة فيه يجب أن يكون المستخدم الذي تمت مصادقته عضوًا في المساحة.
  • مورد Message المطلوب إنشاؤه لتحديد محتوى الرسالة، عليك تضمين الحقل text.

يمكنك اختياريًا تضمين ما يلي:

يعرض الرمز التالي مثالاً على كيفية إرسال تطبيق Chat لرسالة نصية في مساحة معيّنة نيابةً عن مستخدم تمت مصادقته:

Node.js

chat/client-libraries/cloud/create-message-user-cred.js
import {createClientWithUserCredentials} from './authentication-utils.js';

const USER_AUTH_OAUTH_SCOPES = [
  'https://www.googleapis.com/auth/chat.messages.create',
];

// This sample shows how to create message with user credential
async function main() {
  // Create a client
  const chatClient = await createClientWithUserCredentials(
    USER_AUTH_OAUTH_SCOPES,
  );

  // Initialize request argument(s)
  const request = {
    // Replace SPACE_NAME here.
    parent: 'spaces/SPACE_NAME',
    message: {
      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 ' +
        '<https://developers.google.com/workspace/chat/format-messages' +
        '|Chat API developer documentation>.',
    },
  };

  // Make the request
  const response = await chatClient.createMessage(request);

  // Handle the response
  console.log(response);
}

await main();

Python

chat/client-libraries/cloud/create_message_user_cred.py
from authentication_utils import create_client_with_user_credentials
from google.apps import chat_v1 as google_chat

SCOPES = ["https://www.googleapis.com/auth/chat.messages.create"]

def create_message_with_user_cred():
    # Create a client
    client = create_client_with_user_credentials(SCOPES)

    # Initialize request argument(s)
    request = google_chat.CreateMessageRequest(
        # Replace SPACE_NAME here.
        parent = "spaces/SPACE_NAME",
        message = {
            "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 ' +
                    '<https://developers.google.com/workspace/chat/format-messages' +
                    '|Chat API developer documentation>.'
        }
    )

    # Make the request
    response = client.create_message(request)

    # Handle the response
    print(response)

create_message_with_user_cred()

جافا

chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/CreateMessageUserCred.java
import com.google.chat.v1.ChatServiceClient;
import com.google.chat.v1.CreateMessageRequest;
import com.google.chat.v1.Message;

// This sample shows how to create message with user credential.
public class CreateMessageUserCred {

  private static final String SCOPE =
    "https://www.googleapis.com/auth/chat.messages.create";

  public static void main(String[] args) throws Exception {
    try (ChatServiceClient chatServiceClient =
        AuthenticationUtils.createClientWithUserCredentials(
          ImmutableList.of(SCOPE))) {
      CreateMessageRequest.Builder request = CreateMessageRequest.newBuilder()
        // Replace SPACE_NAME here.
        .setParent("spaces/SPACE_NAME")
        .setMessage(Message.newBuilder()
          .setText( "👋🌎 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 " +
                    "<https://developers.google.com/workspace/chat/format-messages" +
                    "|Chat API developer documentation>."));
      Message response = chatServiceClient.createMessage(request.build());

      System.out.println(JsonFormat.printer().print(response));
    }
  }
}

برمجة التطبيقات

chat/advanced-service/Main.gs
/**
 * This sample shows how to create message with user credential
 *
 * It relies on the OAuth2 scope 'https://www.googleapis.com/auth/chat.messages.create'
 * referenced in the manifest file (appsscript.json).
 */
function createMessageUserCred() {
  // Initialize request argument(s)
  // TODO(developer): Replace SPACE_NAME here.
  const parent = "spaces/SPACE_NAME";
  const message = {
    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 " +
      "<https://developers.google.com/workspace/chat/format-messages" +
      "|Chat API developer documentation>.",
  };

  // Make the request
  const response = Chat.Spaces.Messages.create(message, parent);

  // Handle the response
  console.log(response);
}

لتشغيل هذا النموذج، استبدِل SPACE_NAME بالمعرّف من حقل name الخاص بالمساحة. يمكنك الحصول على المعرّف من خلال استدعاء الطريقة ListSpaces() أو من عنوان URL الخاص بالمساحة.

بدء سلسلة محادثات أو الردّ عليها

بالنسبة إلى المساحات التي تستخدم سلاسل المحادثات، يمكنك تحديد ما إذا كانت الرسالة الجديدة تبدأ سلسلة محادثات أو تردّ على سلسلة محادثات حالية.

تبدأ الرسائل التي تنشئها باستخدام Chat API تلقائيًا سلسلة محادثات جديدة. لمساعدتك في تحديد سلسلة المحادثات والردّ عليها لاحقًا، يمكنك تحديد مفتاح سلسلة المحادثات في طلبك:

  • في نص الطلب، حدِّد الحقل thread.threadKey.
  • حدِّد مَعلمة طلب البحث messageReplyOption لتحديد ما يحدث إذا كان المفتاح متوفّرًا من قبل.

لإنشاء رسالة تردّ على سلسلة محادثات حالية:

  • في نص الطلب، أدرِج الحقل thread. في حال ضبط هذا الإعداد، يمكنك تحديد threadKey الذي أنشأته. بخلاف ذلك، يجب استخدام name للسلسلة.
  • حدِّد مَعلمة طلب البحث messageReplyOption.

يعرض الرمز التالي مثالاً على كيفية إرسال تطبيق Chat لرسالة نصية تبدأ سلسلة محادثات معيّنة أو تردّ عليها، ويتم تحديدها من خلال مفتاح مساحة معيّنة نيابةً عن مستخدم مصادَق عليه:

Node.js

chat/client-libraries/cloud/create-message-user-cred-thread-key.js
import {protos} from '@google-apps/chat';
import {createClientWithUserCredentials} from './authentication-utils.js';

const USER_AUTH_OAUTH_SCOPES = [
  'https://www.googleapis.com/auth/chat.messages.create',
];

// This sample shows how to create message with user credential with thread key
async function main() {
  // Create a client
  const chatClient = await createClientWithUserCredentials(
    USER_AUTH_OAUTH_SCOPES,
  );

  // Initialize request argument(s)
  const request = {
    // Replace SPACE_NAME here.
    parent: 'spaces/SPACE_NAME',
    // Creates the message as a reply to the thread specified by thread_key
    // If it fails, the message starts a new thread instead
    messageReplyOption:
      protos.google.chat.v1.CreateMessageRequest.MessageReplyOption
        .REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
    message: {
      text: 'Hello with user credential!',
      thread: {
        // Thread key specifies a thread and is unique to the chat app
        // that sets it
        threadKey: 'THREAD_KEY',
      },
    },
  };

  // Make the request
  const response = await chatClient.createMessage(request);

  // Handle the response
  console.log(response);
}

await main();

Python

chat/client-libraries/cloud/create_message_user_cred_thread_key.py
from authentication_utils import create_client_with_user_credentials
from google.apps import chat_v1 as google_chat

import google.apps.chat_v1.CreateMessageRequest.MessageReplyOption

SCOPES = ["https://www.googleapis.com/auth/chat.messages.create"]

# This sample shows how to create message with user credential with thread key
def create_message_with_user_cred_thread_key():
    # Create a client
    client = create_client_with_user_credentials(SCOPES)

    # Initialize request argument(s)
    request = google_chat.CreateMessageRequest(
        # Replace SPACE_NAME here
        parent = "spaces/SPACE_NAME",
        # Creates the message as a reply to the thread specified by thread_key.
        # If it fails, the message starts a new thread instead.
        message_reply_option = MessageReplyOption.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD,
        message = {
            "text": "Hello with user credential!",
            "thread": {
                # Thread key specifies a thread and is unique to the chat app
                # that sets it.
                "thread_key": "THREAD_KEY"
            }
        }
    )

    # Make the request
    response = client.create_message(request)

    # Handle the response
    print(response)

create_message_with_user_cred_thread_key()

جافا

chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/CreateMessageUserCredThreadKey.java
import com.google.chat.v1.ChatServiceClient;
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;

// This sample shows how to create message with a thread key with user
// credential.
public class CreateMessageUserCredThreadKey {

  private static final String SCOPE =
    "https://www.googleapis.com/auth/chat.messages.create";

  public static void main(String[] args) throws Exception {
    try (ChatServiceClient chatServiceClient =
        AuthenticationUtils.createClientWithUserCredentials(
          ImmutableList.of(SCOPE))) {
      CreateMessageRequest.Builder request = CreateMessageRequest.newBuilder()
        // Replace SPACE_NAME here.
        .setParent("spaces/SPACE_NAME")
        // Creates the message as a reply to the thread specified by thread_key.
        // If it fails, the message starts a new thread instead.
        .setMessageReplyOption(
          MessageReplyOption.REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD)
        .setMessage(Message.newBuilder()
          .setText("Hello with user credentials!")
          // Thread key specifies a thread and is unique to the chat app
          // that sets it.
          .setThread(Thread.newBuilder().setThreadKey("THREAD_KEY")));
      Message response = chatServiceClient.createMessage(request.build());

      System.out.println(JsonFormat.printer().print(response));
    }
  }
}

برمجة التطبيقات

chat/advanced-service/Main.gs
/**
 * This sample shows how to create message with user credential with thread key
 *
 * It relies on the OAuth2 scope 'https://www.googleapis.com/auth/chat.messages.create'
 * referenced in the manifest file (appsscript.json).
 */
function createMessageUserCredThreadKey() {
  // Initialize request argument(s)
  // TODO(developer): Replace SPACE_NAME here.
  const parent = "spaces/SPACE_NAME";
  // Creates the message as a reply to the thread specified by thread_key
  // If it fails, the message starts a new thread instead
  const messageReplyOption = "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD";
  const message = {
    text: "Hello with user credential!",
    thread: {
      // Thread key specifies a thread and is unique to the chat app
      // that sets it
      threadKey: "THREAD_KEY",
    },
  };

  // Make the request
  const response = Chat.Spaces.Messages.create(message, parent, {
    messageReplyOption: messageReplyOption,
  });

  // Handle the response
  console.log(response);
}

لتشغيل هذا النموذج، استبدِل ما يلي:

  • ‫THREAD_KEY: مفتاح سلسلة محادثات حالي في المساحة، أو اسم فريد لسلسلة المحادثات من أجل إنشاء سلسلة محادثات جديدة.
  • ‫SPACE_NAME: رقم التعريف من حقل name الخاص بالمساحة يمكنك الحصول على المعرّف من خلال استدعاء الطريقة ListSpaces() أو من عنوان URL الخاص بالمساحة.

تسمية رسالة

لاسترداد رسالة أو تحديدها في طلبات البيانات المستقبلية من واجهة برمجة التطبيقات، يمكنك تسمية رسالة من خلال ضبط الحقل messageId في طلبك. تسمية رسالتك تتيح لك تحديد الرسالة بدون الحاجة إلى تخزين المعرّف الذي يحدّده النظام من اسم المورد للرسالة (الممثَّل في حقل name).

على سبيل المثال، لاسترداد رسالة باستخدام طريقة get()، يمكنك استخدام اسم المورد لتحديد الرسالة المطلوب استردادها. يتم تنسيق اسم المورد على النحو التالي: spaces/{space}/messages/{message}، حيث يمثّل {message} رقم التعريف الذي يحدّده النظام أو الاسم المخصّص الذي حدّدته عند إنشاء الرسالة.

لتسمية رسالة، حدِّد معرّفًا مخصّصًا في الحقل messageId عند إنشاء الرسالة. يضبط الحقل messageId قيمة الحقل clientAssignedMessageId للمورد Message.

يمكنك تسمية رسالة عند إنشائها فقط. لا يمكنك تسمية معرّف مخصّص أو تعديله للرسائل الحالية. يجب أن يستوفي المعرّف المخصّص المتطلبات التالية:

  • يبدأ بـ "client-". على سبيل المثال، client-custom-name هو معرّف مخصّص صالح، ولكن custom-name ليس كذلك.
  • يحتوي على ما يصل إلى 63 حرفًا وأحرف صغيرة وأرقام وواصلات فقط.
  • أن يكون فريدًا داخل مساحة معيّنة لا يمكن لتطبيق Chat استخدام المعرّف المخصّص نفسه لرسائل مختلفة.

يوضّح الرمز التالي مثالاً على كيفية إرسال تطبيق Chat لرسالة نصية تتضمّن معرّفًا إلى مساحة معيّنة نيابةً عن مستخدم تمت مصادقته:

Node.js

chat/client-libraries/cloud/create-message-user-cred-message-id.js
import {createClientWithUserCredentials} from './authentication-utils.js';

const USER_AUTH_OAUTH_SCOPES = [
  'https://www.googleapis.com/auth/chat.messages.create',
];

// This sample shows how to create a message with user credentials and a custom
// message id
async function main() {
  // Create a client
  const chatClient = await createClientWithUserCredentials(
    USER_AUTH_OAUTH_SCOPES,
  );

  // Initialize request argument(s)
  const request = {
    // Replace SPACE_NAME here.
    parent: 'spaces/SPACE_NAME',
    // Message id lets chat apps get, update or delete a message without needing
    // to store the system assigned ID in the message's resource name
    messageId: 'client-MESSAGE-ID',
    message: {text: 'Hello with user credential!'},
  };

  // Make the request
  const response = await chatClient.createMessage(request);

  // Handle the response
  console.log(response);
}

await main();

Python

chat/client-libraries/cloud/create_message_user_cred_message_id.py
from authentication_utils import create_client_with_user_credentials
from google.apps import chat_v1 as google_chat

SCOPES = ["https://www.googleapis.com/auth/chat.messages.create"]

# This sample shows how to create message with user credential with message id
def create_message_with_user_cred_message_id():
    # Create a client
    client = create_client_with_user_credentials(SCOPES)

    # Initialize request argument(s)
    request = google_chat.CreateMessageRequest(
        # Replace SPACE_NAME here
        parent = "spaces/SPACE_NAME",
        # Message id let chat apps get, update or delete a message without needing
        # to store the system assigned ID in the message's resource name.
        message_id = "client-MESSAGE-ID",
        message = {
            "text": "Hello with user credential!"
        }
    )

    # Make the request
    response = client.create_message(request)

    # Handle the response
    print(response)

create_message_with_user_cred_message_id()

جافا

chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/CreateMessageUserCredMessageId.java
import com.google.chat.v1.ChatServiceClient;
import com.google.chat.v1.CreateMessageRequest;
import com.google.chat.v1.Message;

// This sample shows how to create message with message id specified with user
// credential.
public class CreateMessageUserCredMessageId {

  private static final String SCOPE =
    "https://www.googleapis.com/auth/chat.messages.create";

  public static void main(String[] args) throws Exception {
    try (ChatServiceClient chatServiceClient =
        AuthenticationUtils.createClientWithUserCredentials(
          ImmutableList.of(SCOPE))) {
      CreateMessageRequest.Builder request = CreateMessageRequest.newBuilder()
        // Replace SPACE_NAME here.
        .setParent("spaces/SPACE_NAME")
        .setMessage(Message.newBuilder()
          .setText("Hello with user credentials!"))
        // Message ID lets chat apps get, update or delete a message without
        // needing to store the system assigned ID in the message's resource
        // name.
        .setMessageId("client-MESSAGE-ID");
      Message response = chatServiceClient.createMessage(request.build());

      System.out.println(JsonFormat.printer().print(response));
    }
  }
}

برمجة التطبيقات

chat/advanced-service/Main.gs
/**
 * This sample shows how to create message with user credential with message id
 *
 * It relies on the OAuth2 scope 'https://www.googleapis.com/auth/chat.messages.create'
 * referenced in the manifest file (appsscript.json).
 */
function createMessageUserCredMessageId() {
  // Initialize request argument(s)
  // TODO(developer): Replace SPACE_NAME here.
  const parent = "spaces/SPACE_NAME";
  // Message id lets chat apps get, update or delete a message without needing
  // to store the system assigned ID in the message's resource name
  const messageId = "client-MESSAGE-ID";
  const message = { text: "Hello with user credential!" };

  // Make the request
  const response = Chat.Spaces.Messages.create(message, parent, {
    messageId: messageId,
  });

  // Handle the response
  console.log(response);
}

لتشغيل هذا النموذج، استبدِل ما يلي:

  • ‫SPACE_NAME: رقم التعريف من حقل name الخاص بالمساحة يمكنك الحصول على المعرّف من خلال استدعاء الطريقة ListSpaces() أو من عنوان URL الخاص بالمساحة.
  • ‫MESSAGE-ID: اسم للرسالة يبدأ بـ custom- يجب أن يكون فريدًا من أي أسماء رسائل أخرى تم إنشاؤها بواسطة تطبيق Chat في المساحة المحددة.

اقتباس رسالة

يمكنك اقتباس رسالة أخرى من خلال استدعاء CreateMessage() (rpc، rest) وضبط quotedMessageMetadata (rpc، rest) في الطلب.

يمكنك اقتباس الرسائل ضمن سلسلة محادثات أو في المحادثة الرئيسية، ولكن لا يمكنك اقتباس رسالة من سلسلة محادثات مختلفة.

يوضّح الرمز التالي كيفية إنشاء رسالة تقتبس رسالة أخرى:

Node.js

import {createClientWithUserCredentials} from './authentication-utils.js';

const USER_AUTH_OAUTH_SCOPES = ['https://www.googleapis.com/auth/chat.messages.create'];

// This sample shows how to create a message that quotes another message.
async function main() {

  // Create a client
  const chatClient = await createClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);

  // Initialize request argument(s)
  const request = {

    // TODO(developer): Replace SPACE_NAME .
    parent: 'spaces/SPACE_NAME',

    message: {
      text: 'I am responding to a quoted message!',

      // quotedMessageMetadata lets Chat apps respond to a message by quoting it.
      quotedMessageMetadata: {

        // TODO(developer): Replace QUOTED_MESSAGE_NAME
        // and QUOTED_MESSAGE_LAST_UPDATE_TIME.
        name: 'QUOTED_MESSAGE_NAME',
        lastUpdateTime: 'QUOTED_MESSAGE_LAST_UPDATE_TIME'
      }
    }
  };

  // Make the request
  const response = await chatClient.createMessage(request);

  // Handle the response
  console.log(response);
}

main().catch(console.error);

Python

from authentication_utils import create_client_with_user_credentials
from google.apps import chat_v1 as google_chat
from google.protobuf.timestamp_pb2 import Timestamp

SCOPES = ['https://www.googleapis.com/auth/chat.messages.create']

# This sample shows how to create a message that quotes another message.
def create_message_quote_message():
    '''Creates a message that quotes another message.'''

    # Create a client
    client = create_client_with_user_credentials(SCOPES)

    # Create a timestamp from the RFC-3339 string.
    # TODO(developer): Replace QUOTED_MESSAGE_LAST_UPDATE_TIME.
    last_update_time = Timestamp()
    last_update_time.FromJsonString('QUOTED_MESSAGE_LAST_UPDATE_TIME')

    # Initialize request argument(s)
    request = google_chat.CreateMessageRequest(

        # TODO(developer): Replace SPACE_NAME.
        parent='spaces/SPACE_NAME',

        # Create the message.
        message = google_chat.Message(
            text='I am responding to a quoted message!',

            # quotedMessageMetadata lets Chat apps respond to a message by quoting it.
            quoted_message_metadata=google_chat.QuotedMessageMetadata(

                name='QUOTED_MESSAGE_NAME',
                last_update_time=last_update_time
            )
        )
    )

    # Make the request
    response = client.create_message(request)

    # Handle the response
    print(response)

create_message_quote_message()

جافا

import com.google.chat.v1.ChatServiceClient;
import com.google.chat.v1.CreateMessageRequest;
import com.google.chat.v1.Message;
import com.google.chat.v1.QuotedMessageMetadata;
import com.google.protobuf.util.Timestamps;
import com.google.workspace.api.chat.samples.utils.AuthenticationUtils;
import java.text.ParseException;

// This sample shows how to create a message that quotes another message.
public class CreateMessageQuoteMessage {
  public static void main(String[] args) throws Exception, ParseException {
    // Create a client.
    ChatServiceClient chatClient = AuthenticationUtils.createClientWithUserCredentials();

    // Initialize request argument(s).
    // TODO(developer): Replace SPACE_NAME, QUOTED_MESSAGE_NAME,
    // and QUOTED_MESSAGE_LAST_UPDATE_TIME here.
    String parent = "spaces/SPACE_NAME";
    String quotedMessageName = "QUOTED_MESSAGE_NAME";
    String lastUpdateTime = "QUOTED_MESSAGE_LAST_UPDATE_TIME";

    QuotedMessageMetadata quotedMessageMetadata =
        QuotedMessageMetadata.newBuilder()
            .setName(quotedMessageName)
            .setLastUpdateTime(Timestamps.parse(lastUpdateTime))
            .build();

    Message message = Message.newBuilder()
        .setText("I am responding to a quoted message!")
        .setQuotedMessageMetadata(quotedMessageMetadata)
        .build();

    CreateMessageRequest request =
        CreateMessageRequest.newBuilder()
            .setParent(parent)
            .setMessage(message)
            .build();

    // Make the request.
    Message response = chatClient.createMessage(request);

    // Handle the response.
    System.out.println(response);
  }
}

برمجة التطبيقات

/**
 * Creates a message that quotes another message.
 *
 * Relies on the OAuth2 scope 'https://www.googleapis.com/auth/chat.messages.create'
 * referenced in the manifest file (appsscript.json).
 */
function createMessageQuoteMessage() {

  // Initialize request argument(s)
  // TODO(developer): Replace SPACE_NAME here.
  const parent = 'spaces/SPACE_NAME';

  const message = {

    // The text content of the message.
    text: 'I am responding to a quoted message!',

    // quotedMessageMetadata lets Chat apps respond to a message by quoting it.
    //
    // TODO(developer): Replace QUOTED_MESSAGE_NAME
    // and QUOTED_MESSAGE_LAST_UPDATE_TIME .
    quotedMessageMetadata: {
      name: 'QUOTED_MESSAGE_NAME',
      lastUpdateTime: 'QUOTED_MESSAGE_LAST_UPDATE_TIME',
    }
  };

  // Make the request
  const response = Chat.Spaces.Messages.create(message, parent);

  // Handle the response
  console.log(response);
}

لتشغيل هذا النموذج، استبدِل ما يلي:

  • ‫SPACE_NAME: رقم التعريف من حقل name الخاص بالمساحة يمكنك الحصول على المعرّف من خلال استدعاء الطريقة ListSpaces() (rpc، rest) أو من عنوان URL الخاص بالمساحة.
  • ‫QUOTED_MESSAGE_NAME: مورد الرسالة name (rpc, rest) للرسالة التي سيتم اقتباسها بالتنسيق spaces/{space}/messages/{message}.
  • ‫QUOTED_MESSAGE_LAST_UPDATE_TIME: وقت آخر تعديل للرسالة التي تريد اقتباسها إذا لم يتم تعديل الرسالة مطلقًا، يتوافق مع createTime (rpc، rest). إذا تم تعديل الرسالة، يتوافق مع lastUpdateTime (rpc، rest).

تحديد المشاكل وحلّها

عندما يعرض تطبيق Google Chat أو بطاقة خطأً، تعرض واجهة Chat رسالة "حدث خطأ". أو "تتعذّر معالجة طلبك". في بعض الأحيان، لا تعرض واجهة مستخدم Chat أي رسالة خطأ، ولكن ينتج عن تطبيق Chat أو البطاقة نتيجة غير متوقعة، على سبيل المثال، قد لا تظهر رسالة بطاقة.

على الرغم من أنّ رسالة الخطأ قد لا تظهر في واجهة مستخدم Chat، تتوفّر رسائل خطأ وصفية وبيانات السجلّ لمساعدتك في إصلاح الأخطاء عند تفعيل تسجيل الأخطاء في تطبيقات Chat. للحصول على مساعدة في عرض الأخطاء وتصحيحها وإصلاحها، يُرجى الاطّلاع على مقالة تحديد أخطاء Google Chat وحلّها.