با Google Chat توسعه دهید
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این صفحه یک نمای کلی از Google Chat API و برنامههای Google Chat ارائه میکند.
نمای کلی Google Chat API
Chat API شامل سرویسهای gRPC یا منابع REST و روشهایی است که به Chat دسترسی میدهد، از جمله فضاها، اعضای فضایی، پیامها، واکنشهای پیام، پیوستهای پیام، رویدادهای فضایی و حالتهای خواندن کاربر.
مفاهیم
بخش زیر خدمات، منابع و روشهای مربوط به Chat API را تعریف میکند:
- فضاها
فضاها مکانهایی هستند که افراد و برنامهها میتوانند با هم گفتگو کرده و فایلها را به اشتراک بگذارند. چند نوع فضا وجود دارد. پیامهای مستقیم (DM) مکالمات 1:1 بین دو کاربر یا یک کاربر و یک برنامه چت هستند. چت گروهی مکالمه بین سه یا چند کاربر و برنامه های چت است. فضاهای نامگذاری شده مکانهایی هستند که افراد در آن پیام میفرستند، فایلها را به اشتراک میگذارند و همکاری میکنند.
مرجع منبع:
برای مثال استفاده، نگاه کنید به:
- اعضا
اعضا کاربران و برنامههای چت هستند که به یک فضا پیوستهاند یا به آن دعوت شدهاند.
مرجع منبع:
برای مثال استفاده، نگاه کنید به:
- پیام ها
پیامها شامل پیامهای متنی و کارتی هستند که در فضاها ارسال میشوند. پیامها میتوانند فایلهایی به آنها پیوست داشته باشند. افراد می توانند با اضافه کردن ایموجی به پیام ها به آنها واکنش نشان دهند.
مرجع منبع:
برای مثال استفاده، نگاه کنید به:
- واکنش ها
واکنشها نشاندهنده شکلکهایی هستند که افراد برای واکنش به یک پیام استفاده میکنند، مانند 👍، 🚲، و 🌞.
مرجع منبع:
برای مثال استفاده، نگاه کنید به:
- ایموجی سفارشی
شکلک سفارشی نشان دهنده شکلک های سفارشی ایجاد شده و به اشتراک گذاشته شده در سازمان در Google Chat است. ایموجی سفارشی می تواند در محتوای یک پیام گنجانده شود یا برای واکنش به یک پیام استفاده شود.
مرجع منبع:
برای مثال استفاده، نگاه کنید به:
- رسانه ها و پیوست ها
رسانه فایلی را نشان میدهد که در چت Google آپلود شده است، مانند تصاویر، ویدیوها و اسناد.
مرجع منبع رسانه (در RPC موجود نیست):
پیوست ها نمونه هایی از رسانه (فایل) هستند که به پیام ها پیوست شده اند.
مرجع منبع:
برای مثال استفاده، نگاه کنید به:
- رویدادهای فضایی
رویدادهای فضایی نشان دهنده تغییرات در یک فضا یا منابع فرزند آن، از جمله اعضا، پیام ها و واکنش های آن است.
مرجع منبع:
برای مثال استفاده، نگاه کنید به:
- وضعیت خواندن کاربر
وضعیتهای خواندن کاربر منابع تکی هستند که جزئیات مربوط به آخرین پیام خوانده شده کاربر مشخص شده در فضای چت Google یا رشته پیام را نشان میدهند.
مرجع منبع وضعیت خواندن فاصله:
مرجع منبع وضعیت خواندن موضوع:
برای مثال استفاده، نگاه کنید به:
- تنظیمات اعلان فضای کاربر
تنظیمات اعلان فضای کاربر منابع تکی هستند که تنظیمات اعلان کاربر مشخص شده را در فضای چت Google نشان می دهند.
مرجع منبع:
احراز هویت
فراخوانی Chat API نیاز به احراز هویت دارد. هر روش Chat API به احراز هویت کاربر (برای انجام اقدامات یا دسترسی به دادهها از طرف یک کاربر) یا تأیید اعتبار برنامه (برای انجام اقدامات یا دسترسی به دادهها به عنوان برنامه چت) نیاز دارد. برخی از روش ها هم از احراز هویت کاربر و هم از تأیید اعتبار برنامه پشتیبانی می کنند.
برای کسب اطلاعات بیشتر درباره احراز هویت در چت، به نمای کلی احراز هویت مراجعه کنید.
کتابخانه های مشتری
روش توصیه شده برای اکثر توسعه دهندگان برای فراخوانی Google Chat API با کتابخانه های Cloud Client ما برای زبان دلخواه شما مانند Python، جاوا یا Node.js است.
اگر با Google Apps Script کدنویسی می کنید، به جای نصب کتابخانه سرویس گیرنده، از سرویس گفتگوی پیشرفته استفاده کنید.
ساخت برنامه های چت
Chat API به شما امکان میدهد برنامههای Google Chat بسازید که خدمات و منابع شما را مستقیماً در Google Chat قرار میدهند. میتوانید برنامههای چت را برای انجام یکی از کارهای زیر بسازید:
- بازیابی اطلاعات بر اساس جستجوهای متنی ساختاریافته یا آزاد وارد شده توسط کاربر.
- با استفاده از اطلاعات ارائه شده توسط کاربر، گزارش های حادثه یا سایر مصنوعات را ایجاد کنید.
- همکاری تیمی را تقویت کنید، مانند ارائه "حافظه تیم" یا منابع برنامه ریزی.
می توانید برنامه چت خود را با استفاده از چندین سبک معماری مختلف طراحی کنید، از جمله موارد زیر:
- برنامههای تعاملی : به تعامل کاربر، مانند نامگذاریهای @ یا دستورات اسلش پاسخ دهید و اطلاعات را ارائه کنید یا کاربران را از طریق یک گردش کار با کارتها و گفتگوها راهنمایی کنید.
- برنامههای خط فرمان یا قلابهای وب : پیامهای فعال مانند زنگ هشدار یا اعلانها را از یک سیستم دیگر به یک فضا ارسال کنید. کاربران نمی توانند مستقیماً با این نوع برنامه تعامل داشته باشند.
- برنامههای رویداد محور : در یک فضای گپ مشترک شوید و به آن واکنش نشان دهید، مانند پیوستن یک عضو جدید. در پاسخ به یک رویداد، برنامه میتواند پیامی ارسال کند یا اقدام دیگری انجام دهد.
برای جزئیات در مورد طراحی برنامه چت، به انتخاب معماری برنامه چت Google مراجعه کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-04 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-04 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eGoogle Chat apps integrate services directly into chats, enabling users to access information and take action without leaving the conversation.\u003c/p\u003e\n"],["\u003cp\u003eThese apps support various functionalities, including workflow management, data collection, and interactive elements like dialogs and slash commands.\u003c/p\u003e\n"],["\u003cp\u003eChoose from interactive, non-interactive, or event-driven architectures to build apps that cater to your specific needs and use cases.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Chat apps can be built using various platforms like AppSheet, Google Apps Script, and Dialogflow.\u003c/p\u003e\n"],["\u003cp\u003eAccess to user data beyond basic identity requires authentication and user consent, ensuring privacy and security.\u003c/p\u003e\n"]]],["Google Chat apps integrate services directly into conversations, allowing users to access information and perform actions without leaving the chat. These apps can send text or card messages within spaces or direct messages. They can be interactive, responding to mentions and commands, or non-interactive, sending messages without user interaction. Apps can retrieve information, file tickets, and coordinate team efforts. Developers can build these apps using diverse platforms, manage deployments, and publish them on the Google Workspace Marketplace.\n"],null,["# Develop with Google Chat\n\nThis page provides an overview of the Google Chat API and Google Chat apps.\n\nGoogle Chat API overview\n------------------------\n\nThe Chat API consists of\n[gRPC services or REST resources and methods](https://cloud.google.com/apis/docs/client-libraries-explained)\nthat grant access to Chat, including spaces, space members,\nmessages, message reactions, message attachments, space events, and user read\nstates.\n\n### Concepts\n\nThe following section defines the services, resources, and methods for the\nChat API:\n\n*Spaces*\n\n: *Spaces* are places where people and apps can converse and share files. There\n are several types of spaces. Direct messages (DMs) are 1:1 conversations\n between two users or a user and a Chat app. Group\n chats are conversations between three or more users and\n Chat apps. Named spaces are persistent places where people send\n messages, share files, and collaborate.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.Space)\n - [REST reference](/workspace/chat/api/reference/rest/v1/spaces)\n\n: For example usage, see:\n\n - [Create a space](/workspace/chat/create-spaces)\n - [Set up a space](/workspace/chat/set-up-spaces)\n - [Get a space](/workspace/chat/get-spaces)\n - [List spaces](/workspace/chat/list-spaces)\n - [Update a space](/workspace/chat/update-spaces)\n - [Delete a space](/workspace/chat/delete-spaces)\n - [Find a direct message (DM)](/workspace/chat/find-direct-message-in-spaces)\n\n*Members*\n\n: *Members* are users and Chat apps that have joined or are\n invited to a space.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.Membership)\n - [REST reference](/workspace/chat/api/reference/rest/v1/spaces.members)\n\n: For example usage, see:\n\n - [Create a membership](/workspace/chat/create-members)\n - [Get a membership](/workspace/chat/get-members)\n - [List memberships](/workspace/chat/list-members)\n - [Update a membership](/workspace/chat/update-members)\n - [Delete a membership](/workspace/chat/delete-members)\n\n*Messages*\n\n: *Messages* include\n [text](/workspace/chat/api/reference/rest/v1/spaces.messages)\n and\n [card](/workspace/chat/api/reference/rest/v1/cards)\n communications posted in spaces. Messages can have files attached to them.\n People can react to messages by appending emoji to them.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.Message)\n - [REST reference](/workspace/chat/api/reference/rest/v1/spaces.messages)\n\n: For example usage, see:\n\n - [Create a message](/workspace/chat/create-messages)\n - [Get a message](/workspace/chat/get-messages)\n - [List messages](/workspace/chat/list-messages)\n - [Update a message](/workspace/chat/update-messages)\n - [Delete a message](/workspace/chat/delete-messages)\n\n*Reactions*\n\n: *Reactions* represent the emoji people use to react to a message, such as\n 👍, 🚲, and 🌞.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.Reaction)\n - [REST reference](/workspace/chat/api/reference/rest/v1/spaces.messages.reactions)\n\n: For example usage, see:\n\n - [Create a reaction](/workspace/chat/create-reactions)\n - [List reactions](/workspace/chat/list-reactions)\n - [Delete a reaction](/workspace/chat/delete-reactions)\n\n*Custom emoji*\n\n: *Custom emoji* represent custom emoji created and shared within the\n organization in Google Chat. Custom emoji can be included in the content of\n a message or used to react to a message.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.CustomEmoji)\n - [REST reference](/workspace/chat/api/reference/rest/v1/customEmojis)\n\n: For example usage, see:\n\n - [Create a custom emoji](/workspace/chat/create-custom-emoji)\n - [Delete a custom emoji](/workspace/chat/delete-custom-emoji)\n - [Get details about a custom emoji](/workspace/chat/get-custom-emoji)\n - [List custom emojis in an organization](/workspace/chat/list-custom-emojis)\n\n*Media and attachments*\n\n: *Media* represents a file uploaded to Google Chat, like images, videos, and\n documents.\n\n: Media resource reference (Unavailable in RPC):\n\n - [REST reference](/workspace/chat/api/reference/rest/v1/media)\n\n: *Attachments* are instances of media (files) attached to messages.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.Attachment)\n - [REST reference](/workspace/chat/api/reference/rest/v1/spaces.messages.attachments)\n\n: For example usage, see:\n\n - [Upload media as an attachment](/workspace/chat/upload-media-attachments)\n - [Download media as an attachment](/workspace/chat/download-media-attachments)\n - [Get an attachment](/workspace/chat/get-media-attachments)\n\n*Space events*\n\n: *Space events* represent changes to a space or its\n child resources, including its members, messages, and reactions.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.SpaceEvent)\n - [REST reference](/workspace/chat/api/reference/rest/v1/spaces.spaceEvents)\n\n: For example usage, see:\n\n - [Get space read state](/workspace/chat/get-space-read-state)\n - [Update space read state](/workspace/chat/update-space-read-state)\n - [Get thread read state](/workspace/chat/get-thread-read-state)\n\n*User read states*\n\n: *User read states* are singleton resources that represent details about a\n specified user's last read message in a Google Chat space or a message\n thread.\n\n: Space read state resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.SpaceReadState)\n - [REST reference](/workspace/chat/api/reference/rest/v1/users.spaces)\n\n: Thread read state resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.ThreadReadState)\n - [REST reference](/workspace/chat/api/reference/rest/v1/users.spaces.threads)\n\n: For example usage, see:\n\n - [Get space read state](/workspace/chat/get-space-read-state)\n - [Update space read state](/workspace/chat/update-space-read-state)\n - [Get thread read state](/workspace/chat/get-thread-read-state)\n\n*User space notification settings*\n\n: *User space notification settings* are singleton resources that represent a\n specified user notification settings in a Google Chat space.\n\n: Resource reference:\n\n - [RPC reference](/workspace/chat/api/reference/rpc/google.chat.v1#google.chat.v1.SpaceNotificationSetting)\n - [REST reference](/workspace/chat/api/reference/rest/v1/users.spaces.spaceNotificationSetting)\n\n### Authentication\n\nCalling the Chat API requires authentication. Each\nChat API method requires either\n[user authentication](/workspace/chat/authenticate-authorize-chat-user)\n(to perform actions or access\ndata on behalf of a user) or\n[app authentication](/workspace/chat/authenticate-authorize-chat-app)\n(to perform actions or access data as a Chat app). Some\nmethods support both user authentication and app authentication.\n\nTo learn more about authentication in Chat, see\n[Authentication overview](/workspace/chat/authenticate-authorize).\n\n### Client libraries\n\nThe recommended way for most developers to call the Google Chat API\nis with our officially supported\n[Cloud Client Libraries](/workspace/chat/libraries)\nfor your preferred language, like Python, Java, or Node.js.\n\nIf you're coding with Google Apps Script, use the\n[Advanced Chat service](/apps-script/advanced/chat)\ninstead of installing a client library.\n\nBuild Chat apps\n---------------\n\nThe Chat API lets you build Google Chat apps that bring your\nservices and resources right into Google Chat. You can build\nChat apps to do any of the following:\n\n- Retrieve information based on structured or free text queries entered by the user.\n- Generate incident reports or other artifacts, using information provided by the user.\n- Enhance team collaboration, such as providing \"team memory\" or scheduling resources.\n\nYou can design your Chat app using several different\narchitecture styles, including the following:\n\n- **Interactive apps**: Respond to user interaction, such as @mentions or slash commands, and present information or guide users through a workflow with cards and dialogs.\n- **Command-line apps or webhooks**: Send proactive messages, such as alarms or notifications, from another system into a space. Users can't directly interact with this type of app.\n- **Event-driven apps**: Subscribe to and react to activity in a Chat space, such as a new member joining. In response to an event, the app can send a message or perform another action.\n\nFor details about designing your Chat app, see\n[Choose a Google Chat app architecture](/workspace/chat/structure).\n\nRelated topics\n--------------\n\n- [Explore Google Chat app samples](/workspace/chat/samples).\n- [Build interactive Google Chat apps](/workspace/chat/interact-users-overview).\n- [Choose a Google Chat app architecture](/workspace/chat/structure).\n\n|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Want to see the Google Chat API in action? The Google Workspace Developers channel offers videos about tips, tricks, and the latest features. [Subscribe now](https://www.youtube.com/channel/UCUcg6az6etU_gRtZVAhBXaw) |"]]