ดูการตั้งค่าการแจ้งเตือนพื้นที่ทำงานของผู้ใช้

คู่มือนี้จะอธิบายวิธีใช้วิธี get() ในทรัพยากร SpaceNotificationSetting ของ Google Chat API เพื่อรับการตั้งค่าการแจ้งเตือนพื้นที่ทำงานของผู้ใช้

SpaceNotificationSetting ทรัพยากรเป็นทรัพยากรแบบ Singleton ที่แสดงรายละเอียดเกี่ยวกับการตั้งค่าการแจ้งเตือนของพื้นที่ทำงานของผู้ใช้ที่ระบุ

ข้อกำหนดเบื้องต้น

Node.js

  • บัญชี Google Workspace รุ่น Business หรือ Enterprise ที่มีสิทธิ์เข้าถึง Google Chat

ดูการตั้งค่าการแจ้งเตือนพื้นที่ทำงานของผู้ใช้ที่โทร

หากต้องการดูรายละเอียดเกี่ยวกับการตั้งค่าการแจ้งเตือนของพื้นที่ทำงานของผู้ใช้ ให้ระบุข้อมูลต่อไปนี้ในคำขอ

  • ระบุchat.users.spacesettingsขอบเขตการให้สิทธิ์
  • เรียกใช้เมธอด GetSpaceNotificationSetting() โดยส่ง name ของการตั้งค่าการแจ้งเตือนของพื้นที่ทำงานเพื่อรับข้อมูลซึ่งรวมถึงรหัสผู้ใช้หรืออีเมลแทนและรหัสพื้นที่ทำงาน คุณจะดูการตั้งค่าการแจ้งเตือนสำหรับผู้ใช้ที่โทรเข้ามาได้เท่านั้น หากต้องการระบุการตั้งค่า ให้ใช้คำสั่งใดคำสั่งหนึ่งต่อไปนี้
    • ชื่อแทน me เช่น users/me/spaces/SPACE_ID/spaceNotificationSetting
    • อีเมล Google Workspace ของผู้ใช้ที่โทร เช่น users/user@example.com/spaces/SPACE_ID/spaceNotificationSetting
    • รหัสผู้ใช้ของผู้ใช้ที่โทร เช่น users/USER/spaces/SPACE/spaceNotificationSetting

ตัวอย่างต่อไปนี้จะรับการตั้งค่าการแจ้งเตือนพื้นที่ทำงานของผู้ใช้ที่โทร

Node.js
chat/client-libraries/cloud/get-space-notification-setting-user-cred.js
import {createClientWithUserCredentials} from './authentication-utils.js';

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

// This sample shows how to get the space notification setting for the calling user
async function main() {
  // Create a client
  const chatClient = await createClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);

  // Initialize request argument(s), replace the SPACE_NAME with an actual space name.
  const request = {
    name : 'users/me/spaces/SPACE_NAME/spaceNotificationSetting'
  };

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

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

main().catch(console.error);

หากต้องการเรียกใช้ตัวอย่างนี้ ให้แทนที่ SPACE_ID ด้วยรหัสจาก name ของพื้นที่ทำงาน คุณรับรหัสได้โดยเรียกใช้เมธอด ListSpaces() หรือจาก URL ของพื้นที่ทำงาน

Google Chat API จะได้รับการตั้งค่าการแจ้งเตือนพื้นที่ทำงานที่ระบุและแสดงผลSpaceNotificationSetting