แสดงรายการอีโมจิที่กำหนดเองในองค์กร

คู่มือนี้อธิบายวิธีใช้เมธอด list ในทรัพยากร CustomEmoji ของ Google Chat API เพื่อแสดงอิโมจิที่กำหนดเองซึ่งผู้ใช้ที่ได้รับการตรวจสอบสิทธิ์ในองค์กร Google Workspace มองเห็น

อีโมจิที่กำหนดเองจะใช้ได้กับบัญชี Google Workspace เท่านั้น และผู้ดูแลระบบต้องเปิดอีโมจิที่กำหนดเองให้องค์กรของคุณ ดูข้อมูลเพิ่มเติมได้ที่ดูข้อมูลเกี่ยวกับอีโมจิที่กำหนดเองใน Google Chat และจัดการสิทธิ์ของอีโมจิที่กำหนดเอง

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

Node.js

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

แสดงรายการอีโมจิที่กำหนดเองในองค์กร

หากต้องการแสดงรายการอีโมจิที่กำหนดเองในองค์กรที่มีการตรวจสอบสิทธิ์ผู้ใช้ ให้ส่งข้อมูลต่อไปนี้ในคำขอ

  • ระบุchat.customemojisขอบเขตการให้สิทธิ์
  • เรียกใช้เมธอด ListCustomEmojis

ตัวอย่างต่อไปนี้แสดงรายการอีโมจิที่กำหนดเองในองค์กร

Node.js

chat/client-libraries/cloud/list-custom-emojis-user-cred.js
import {createClientWithUserCredentials} from './authentication-utils.js';

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

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

  // Initialize request argument(s)
  const request = {
    // Optional. Replace FILTER here
    filter: 'FILTER'
  };

  // Make the request
  const pageResult = await chatClient.listCustomEmojisAsync(request);

  // Handle the response. Iterating over pageResult will yield results and
  // resolve additional pages automatically.
  for await (const response of pageResult) {
    console.log(response);
  }
}

main().catch(console.error);

หากต้องการเรียกใช้ตัวอย่างนี้ ให้แทนที่ข้อมูลต่อไปนี้

  • FILTER: ไม่บังคับ ตัวกรองที่จะใช้กับคำขอรายการ