Menghapus emoji kustom

Panduan ini menjelaskan cara menggunakan metode delete pada resource CustomEmoji Google Chat API untuk menghapus emoji kustom di organisasi Google Workspace.

Secara default, pengguna hanya dapat menghapus emoji kustom yang mereka buat. Pengelola emoji yang ditetapkan oleh administrator dapat menghapus emoji kustom apa pun di organisasi.

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

Menghapus emoji kustom

Untuk menghapus emoji kustom dengan autentikasi pengguna, teruskan hal berikut dalam permintaan Anda:

  • Tentukan cakupan otorisasi chat.customemojis.
  • Panggil metode DeleteCustomEmoji().
    • Dalam isi permintaan, tetapkan name ke nama resource emoji kustom yang akan dihapus.

Contoh berikut menghapus emoji kustom.

Node.js

chat/client-libraries/cloud/delete-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 delete a 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.deleteCustomEmoji(request);

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

main().catch(console.error);

Untuk menjalankan contoh ini, ganti berikut ini:

  • EMOJI_NAME: nama unik untuk emoji kustom Anda, di kolom emoji_name. Anda dapat memperoleh ID dengan memanggil metode ListCustomEmoji, atau dari isi respons yang ditampilkan setelah membuat emoji kustom secara asinkron dengan Chat API.