맞춤 그림 이모티콘에 관한 세부정보 가져오기

이 가이드에서는 Google Chat API의 CustomEmoji 리소스에서 get 메서드를 사용하여 맞춤 이모티콘에 대한 세부정보를 가져오는 방법을 설명합니다.

맞춤 이모티콘은 Google Workspace 계정에서만 사용할 수 있으며 관리자가 조직에 맞춤 이모티콘을 사용 설정해야 합니다. 자세한 내용은 Google Chat의 맞춤 이모티콘 알아보기 및 맞춤 이모티콘 권한 관리를 참고하세요.

기본 요건

Node.js

맞춤 이모티콘에 대한 세부정보 가져오기

사용자 인증으로 맞춤 이모티콘에 대한 세부정보를 가져오려면 요청에 다음을 전달합니다.

  • chat.customemojis 승인 범위를 지정합니다.
  • GetCustomEmoji 메서드를 호출합니다.
  • 요청 본문에서 name을 가져올 맞춤 이모티콘의 리소스 이름으로 설정합니다.

다음 예에서는 맞춤 이모티콘의 세부정보를 가져옵니다.

Node.js

chat/client-libraries/cloud/get-custom-emoji-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 = {
    // TODO(developer): Replace EMOJI_NAME here
    name: 'customEmojis/EMOJI_NAME',
  };

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

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

await main();

이 샘플을 실행하려면 다음을 바꿉니다.

  • EMOJI_NAME: emoji_name 필드의 맞춤 이모티콘에 대한 고유한 이름입니다. ListCustomEmoji() 메서드를 호출하거나 Chat API를 사용하여 맞춤 이모티콘을 비동기식으로 만든 후 반환된 응답 본문에서 ID를 가져올 수 있습니다.