This guide explains how to use the
list
method on the
CustomEmoji
resource of the Google Chat API to list custom emoji visible to the authenticated user in a Google Workspace organization.
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.
List custom emoji in an organization
To list custom emoji in an organization with user authentication, pass the following in your request:
- Specify the
chat.customemojis
authorization scope. - Call the
ListCustomEmojis
method.
The following example list custom emoji in an organization.
Node.js
To run this sample, replace the following:
FILTER
: Optional, the filter to apply to the list request.