ให้สิทธิ์แอป Google Chat ในการนำเข้าข้อมูล
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมื่อใช้ Google Chat API แอปจะนำเข้าข้อมูลจากแพลตฟอร์มการรับส่งข้อความอื่นๆ ไปยัง Google Chat ได้โดยใช้พื้นที่ทำงานโหมดการนำเข้า ดูข้อมูลเพิ่มเติมได้ที่นำเข้าข้อมูลข้อความจากบริการอื่นไปยัง Google Chat
หากต้องการอ่านและเขียนทรัพยากรในพื้นที่โหมดนำเข้า คุณต้องตรวจสอบสิทธิ์แอป Chat ด้วยบัญชีบริการ
ผู้ดูแลระบบต้องให้ขอบเขตการให้สิทธิ์ Chat API ต่อไปนี้แก่บัญชีบริการ https://www.googleapis.com/auth/chat.import
เฉพาะผู้ดูแลระบบโดเมน Google Workspace เท่านั้นที่ให้ขอบเขต OAuth นี้แก่บัญชีบริการผ่านการมอบสิทธิ์ทั่วทั้งโดเมนได้
ทุกโดเมนที่แอป Chat สร้างพื้นที่ทำงานของโหมดการนำเข้า
ต้องมีขอบเขต OAuth นี้ หลังจากที่บัญชีบริการได้รับมอบสิทธิ์ระดับโดเมนสำหรับขอบเขตนี้แล้ว แอปใน Chat จะเข้าถึงพื้นที่ทำงานในโหมดนำเข้าได้โดยแอบอ้างเป็นบัญชีผู้ใช้
ในบางกรณี บัญชีผู้ใช้สำหรับการแอบอ้างอาจไม่พร้อมใช้งานอีกต่อไป
ในกรณีเหล่านี้ แอป Chat สามารถใช้ข้อมูลเข้าสู่ระบบบัญชีบริการเป็นข้อมูลสำรองได้ ตัวอย่างเช่น หากคุณลบบัญชีผู้ใช้
ที่ใช้ในระหว่างการสร้างข้อความ แอป Chat จะใช้ข้อมูลเข้าสู่ระบบบัญชีบริการของตนเอง
เพื่อสร้างข้อความที่มีเนื้อหาเดียวกันได้ แอป Chat สามารถ
เข้าถึงพื้นที่โหมดนำเข้าในฐานะแอปที่ใช้ข้อมูลเข้าสู่ระบบบัญชีบริการที่มี
ขอบเขต OAuth ต่อไปนี้ https://www.googleapis.com/auth/chat.bot
ไม่จำเป็นต้องใช้ขอบเขต Google Chat API อื่นๆ
เมื่อนำเข้าทรัพยากรไปยังพื้นที่ทำงานโหมดการนำเข้า
แอปใน Chat จะนำเข้าเนื้อหาได้เฉพาะในพื้นที่ทำงานโหมดการนำเข้า
ที่แอปสร้างขึ้นเท่านั้น และจะนำเข้าในพื้นที่ทำงานโหมดการนำเข้าที่แอปอื่นสร้างขึ้นไม่ได้
ตารางต่อไปนี้แสดงรายการเมธอดของทรัพยากรที่แอป Chat เรียกใช้ได้ในพื้นที่ทำงานโหมดนำเข้า และประเภทการตรวจสอบสิทธิ์ที่รองรับ
วิธีการของทรัพยากร |
รองรับการสวมบทบาทเป็นผู้ใช้ |
ข้อมูลเข้าสู่ระบบบัญชีบริการที่รองรับ |
spaces.create
|
ใช่ |
ไม่ใช่ |
spaces.get
|
ไม่ได้ |
ใช่ |
spaces.update
|
ใช่ |
ไม่ใช่ |
spaces.delete
|
ใช่ |
ไม่ใช่ |
spaces.completeImport
|
ใช่ |
ไม่ใช่ |
spaces.messages.create
|
ใช่ |
ใช่ |
spaces.messages.delete
|
ใช่ |
ใช่ |
spaces.messages.get
|
ไม่ใช่ |
ใช่ |
spaces.messages.list
|
ใช่ |
ไม่ใช่ |
spaces.messages.update
|
ใช่ |
ใช่ |
spaces.messages.reactions.create
|
ใช่ |
ไม่ใช่ |
spaces.messages.reactions.delete
|
ใช่ |
ไม่ใช่ |
spaces.members.create
|
ใช่ |
ไม่ใช่ |
spaces.members.delete
|
ใช่ |
ไม่ใช่ |
spaces.members.list
|
ใช่ |
ไม่ใช่ |
media.upload
|
ใช่ |
ไม่ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[[["\u003cp\u003eGoogle Chat API allows importing data from other platforms into Google Chat using import mode spaces.\u003c/p\u003e\n"],["\u003cp\u003eChat apps require specific authentication and authorization to read and write resources in these spaces, needing domain administrator approval.\u003c/p\u003e\n"],["\u003cp\u003eApps can impersonate user accounts or utilize their service account credentials for specific actions within import mode spaces.\u003c/p\u003e\n"],["\u003cp\u003eImport mode spaces support various resource methods with differing authentication requirements, as detailed in the provided table.\u003c/p\u003e\n"],["\u003cp\u003eChat apps can only import content into spaces they create and not into spaces created by other apps.\u003c/p\u003e\n"]]],["Apps use the Google Chat API's import mode to bring data from other platforms into Google Chat. This requires authentication with a service account granted the `https://www.googleapis.com/auth/chat.import` scope via domain-wide delegation by a Google Workspace admin. Apps can impersonate user accounts or use service account credentials (`https://www.googleapis.com/auth/chat.bot`). Only specific resource methods are supported in import mode spaces. Import mode is exclusive, meaning apps can only modify spaces they create.\n"],null,["# Authorize Google Chat apps to import data\n\nWith the Google Chat API, apps can import data from other messaging platforms into\nGoogle Chat by using *import mode* spaces. For more information, see\n[Import message data to Google Chat from another service](https://support.google.com/a/answer/13465849).\n\nTo read and write resources in import mode spaces, you must\n[authenticate Chat apps with a service account](/workspace/chat/authenticate-authorize-chat-app).\nGrant the service account the following Chat API authorization scope\nby an administrator: `https://www.googleapis.com/auth/chat.import`.\n\nOnly Google Workspace domain administrators can grant this OAuth scope to\nservice accounts through\n[domain-wide delegation](/identity/protocols/oauth2/service-account#delegatingauthority).\nEvery domain that a Chat app creates import mode spaces\nin must have this OAuth scope. After the service account has been delegated\ndomain-wide authority for this scope, Chat apps can access import\nmode spaces by\n[impersonating a user account](/identity/protocols/oauth2/service-account#authorizingrequests).\n\nIn some scenarios, the user account for impersonation might no longer be\navailable. In these cases, the Chat app can use their\nservice account credentials as a fallback. For example, if you delete a user\naccount that was used during message creation, the\nChat app can use their own service account credentials\nto create a message containing the same contents. Chat apps can\naccess import mode spaces as an app using service account credentials with the\nfollowing OAuth scope: `https://www.googleapis.com/auth/chat.bot`.\n\nNo other [Google Chat API scopes](/workspace/chat/authenticate-authorize#scopes)\nare required when importing resources into an import mode space.\nChat apps can only import content into the import mode spaces\nthat they create, and not into the import mode spaces created by other apps.\n\nThe following table lists the resource methods that Chat apps can\ncall in import mode spaces, and what kind of authentication they support:\n\n| Resource method | User impersonation supported | Service account credentials supported |\n|------------------------------------|------------------------------|---------------------------------------|\n| `spaces.create` | Yes | No |\n| `spaces.get` | No | Yes |\n| `spaces.update` | Yes | No |\n| `spaces.delete` | Yes | No |\n| `spaces.completeImport` | Yes | No |\n| `spaces.messages.create` | Yes | Yes |\n| `spaces.messages.delete` | Yes | Yes |\n| `spaces.messages.get` | No | Yes |\n| `spaces.messages.list` | Yes | No |\n| `spaces.messages.update` | Yes | Yes |\n| `spaces.messages.reactions.create` | Yes | No |\n| `spaces.messages.reactions.delete` | Yes | No |\n| `spaces.members.create` | Yes | No |\n| `spaces.members.delete` | Yes | No |\n| `spaces.members.list` | Yes | No |\n| `media.upload` | Yes | No |\n\nRelated topics\n--------------\n\n- To learn more about authentication and authorization, see [Authenticate and authorize Google Chat apps and API requests](/workspace/chat/authenticate-authorize).\n- To learn how to set up a service account to access the Google Chat API, see [Authenticate as a Google Chat app](/workspace/chat/authenticate-authorize-chat-app).\n- To learn how to start importing resources using import mode spaces, see [Import data to Google Chat](/workspace/chat/import-data)."]]