Mencantumkan emoji kustom dalam organisasi

Panduan ini menjelaskan cara menggunakan metode list pada resource CustomEmoji Google Chat API untuk mencantumkan emoji kustom yang terlihat oleh pengguna yang diautentikasi di organisasi Google Workspace.

Emoji kustom hanya tersedia untuk akun Google Workspace, dan administrator Anda harus mengaktifkan emoji kustom untuk organisasi Anda. Untuk informasi selengkapnya, lihat Mempelajari emoji kustom di Google Chat dan Mengelola izin emoji kustom.

Prasyarat

Node.js

Mencantumkan emoji kustom dalam organisasi

Untuk mencantumkan emoji kustom di organisasi dengan autentikasi pengguna, teruskan hal berikut dalam permintaan Anda:

  • Tentukan cakupan otorisasi chat.customemojis.
  • Panggil metode ListCustomEmojis.

Contoh berikut mencantumkan emoji kustom dalam organisasi.

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);

Untuk menjalankan contoh ini, ganti berikut ini:

  • FILTER: Opsional, filter yang akan diterapkan pada permintaan daftar.