This guide explains how to use the
get
method on the
CustomEmoji
resource of the Google Chat API to get details about a custom emoji.
Custom emojis are only available for Google Workspace accounts, and your administrator must turn custom emoji on for your organization. For more information, see Learn about custom emoji in Google Chat and Manage custom emoji permissions.
Prerequisites
Node.js
- A Business or Enterprise Google Workspace account with access to Google Chat.
- Set up your environment:
- Create a Google Cloud project.
- Configure the OAuth consent screen.
- Enable and configure the Google Chat API with a name, icon, and description for your Chat app.
- Install the Node.js Cloud Client Library.
- Create access credentials based on how you want to authenticate in your Google Chat API
request:
- To authenticate as a Chat user,
create OAuth client ID
credentials and save the credentials as a JSON file named
credentials.json
to your local directory. - To authenticate as the Chat app,
create service account
credentials and save the credentials as a JSON file named
credentials.json
.
- To authenticate as a Chat user,
create OAuth client ID
credentials and save the credentials as a JSON file named
- Choose an authorization scope based on whether you want to authenticate as a user or the Chat app.
Get details about a custom emoji
To get details about a custom emoji with user authentication, pass the following in your request:
- Specify the
chat.customemojis
authorization scope. - Call the
GetCustomEmoji
method. - In the request body, set
name
to the resource name of the custom emoji to get.
The following example gets details of a custom emoji.
Node.js
To run this sample, replace the following:
EMOJI_NAME
: the unique name for your custom emoji, in theemoji_name
field. You can obtain the ID by calling theListCustomEmoji()
method, or from the response body returned after creating a custom emoji asynchronously with the Chat API.