Method: spaces.members.create
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้างการเป็นสมาชิกสำหรับแอป Chat ที่โทรได้ ผู้ใช้ หรือ Google Group ระบบไม่รองรับการสร้างการเป็นสมาชิกสำหรับแอป Chat อื่นๆ เมื่อสร้างการเป็นสมาชิก หากสมาชิกที่ระบุปิดนโยบายยอมรับอัตโนมัติไว้ ระบบจะเชิญสมาชิกรายนั้น และสมาชิกจะต้องยอมรับคำเชิญเข้าร่วมพื้นที่ก่อนจึงจะเข้าร่วมได้ มิเช่นนั้น การสร้างการเป็นสมาชิกจะเพิ่มสมาชิกไปยังพื้นที่ที่ระบุโดยตรง
รองรับการตรวจสอบสิทธิ์ประเภทต่อไปนี้
ระบบไม่รองรับการตรวจสอบสิทธิ์แอปสำหรับกรณีการใช้งานต่อไปนี้
- เชิญผู้ใช้ภายนอกองค์กร Workspace ที่เป็นเจ้าของพื้นที่ทำงาน
- การเพิ่ม Google Group ในพื้นที่ทำงาน
- การเพิ่มแอป Chat ลงในพื้นที่ทำงาน
ดูตัวอย่างการใช้งานได้ที่
คำขอ HTTP
POST https://chat.googleapis.com/v1/{parent=spaces/*}/members
URL ใช้ไวยากรณ์การแปลงรหัส gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
parent |
string
ต้องระบุ ชื่อทรัพยากรของพื้นที่ทำงานที่จะสร้างการเป็นสมาชิก รูปแบบ: spaces/{space}
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
useAdminAccess |
boolean
ไม่บังคับ เมื่อ true วิธีการจะทำงานโดยใช้สิทธิ์ของผู้ดูแลระบบ Google Workspace ของผู้ใช้ ผู้ใช้ที่โทรต้องเป็นผู้ดูแลระบบ Google Workspace ที่มีสิทธิ์จัดการแชทและการสนทนาในพื้นที่ทำงาน ต้องใช้chat.admin.memberships ขอบเขต OAuth 2.0 ระบบไม่รองรับการสร้างการเป็นสมาชิกแอปหรือการสร้างการเป็นสมาชิกสำหรับผู้ใช้ภายนอกองค์กร Google Workspace ของผู้ดูแลระบบโดยใช้สิทธิ์เข้าถึงของผู้ดูแลระบบ
|
เนื้อความของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ Membership
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ Membership
ที่สร้างขึ้นใหม่
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth อย่างใดอย่างหนึ่งต่อไปนี้
https://www.googleapis.com/auth/chat.app.memberships
https://www.googleapis.com/auth/chat.admin.memberships
https://www.googleapis.com/auth/chat.import
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.app
ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-29 UTC
[null,null,["อัปเดตล่าสุด 2025-07-29 UTC"],[[["\u003cp\u003eCreates memberships for the calling Chat app, a user, or a Google Group in a specified space.\u003c/p\u003e\n"],["\u003cp\u003eSupports app authentication (with admin approval in Developer Preview) and user authentication (with optional admin access).\u003c/p\u003e\n"],["\u003cp\u003eTo use administrator privileges, set the \u003ccode\u003euseAdminAccess\u003c/code\u003e query parameter to \u003ccode\u003etrue\u003c/code\u003e and ensure the user has the required permissions and scope.\u003c/p\u003e\n"],["\u003cp\u003eRequires specific OAuth scopes for authorization, such as \u003ccode\u003echat.app.memberships\u003c/code\u003e or \u003ccode\u003echat.admin.memberships\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIf the member has auto-accept turned off, an invitation is sent; otherwise, they are directly added to the space.\u003c/p\u003e\n"]]],["This describes how to create a membership in Google Chat spaces using a `POST` request to `https://chat.googleapis.com/v1/{parent=spaces/*}/members`. Memberships can be created for a Chat app, user, or Google Group. Authentication supports app or user access, with optional administrator privileges via the `useAdminAccess` query parameter. The request includes path and query parameters and a `Membership` object in the body; the response returns the newly created `Membership`. Authorization requires specific OAuth scopes.\n"],null,["# Method: spaces.members.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a membership for the calling Chat app, a user, or a Google Group. Creating memberships for other Chat apps isn't supported. When creating a membership, if the specified member has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified space.\n\nSupports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):\n\n- [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) and the authorization scope:\n\n - `https://www.googleapis.com/auth/chat.app.memberships`\n- [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.memberships`\n - `https://www.googleapis.com/auth/chat.memberships.app` (to add the calling app to the space)\n - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)\n - User authentication grants administrator privileges when an administrator account authenticates, `useAdminAccess` is `true`, and the following authorization scope is used:\n - `https://www.googleapis.com/auth/chat.admin.memberships`\n\nApp authentication is not supported for the following use cases:\n\n- Inviting users external to the Workspace organization that owns the space.\n- Adding a Google Group to a space.\n- Adding a Chat app to a space.\n\nFor example usage, see:\n\n- [Invite or add a user to a space](https://developers.google.com/workspace/chat/create-members#create-user-membership).\n- [Invite or add a Google Group to a space](https://developers.google.com/workspace/chat/create-members#create-group-membership).\n- [Add the Chat app to a space](https://developers.google.com/workspace/chat/create-members#create-membership-calling-api).\n\n### HTTP request\n\n`POST https://chat.googleapis.com/v1/{parent=spaces/*}/members`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The resource name of the space for which to create the membership. Format: spaces/{space} |\n\n### Query parameters\n\n| Parameters ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `useAdminAccess` | `boolean` Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.memberships` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). Creating app memberships or creating memberships for users outside the administrator's Google Workspace organization isn't supported using admin access. |\n\n### Request body\n\nThe request body contains an instance of [Membership](/workspace/chat/api/reference/rest/v1/spaces.members#Membership).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Membership](/workspace/chat/api/reference/rest/v1/spaces.members#Membership).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.app.memberships`\n- `https://www.googleapis.com/auth/chat.admin.memberships`\n- `https://www.googleapis.com/auth/chat.import`\n- `https://www.googleapis.com/auth/chat.memberships`\n- `https://www.googleapis.com/auth/chat.memberships.app`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]