Call Users API from Team Chat App

Can I call Users API (to find user by email) from the Team Chat App?

I’ve created new Team Chat App and added the required scopes for calling User API - user:read:admin.

When I’m creating the chatbot token, the response contains the access token and scope which includes user:read:admin
image

However, when I use chatbot token to make a call to Users API(GET /users endpoint) I receive 400 response: “Account does not enabled REST API”

Is it possible to retrieve list of users in my account without creating an additional Server-to-Server app?

There is a way, although I don’t know how clear this is from the documentation.

  1. The token you are getting is for the chat client - which is based on the key and secret in the app.
  2. You will need to get the oAuth information when the user adds the app - which is passed in via a query parameter code
async function getAuthToken() {
  const HASHED_ZOOM_KEY = Buffer.from(`${req.variables["ZOOM_CLIENT_ID"]}:${req.variables["ZOOM_CLIENT_SECRET"]}`).toString('base64');

  const meta = {
    "Authorization": `Basic ${HASHED_ZOOM_KEY}`
  }
  const headers = new Headers(meta);

  const options = {
    method: 'POST',
    headers: headers,
  }

  const response = await fetch(`https://zoom.us/oauth/token?grant_type=authorization_code&code=${req.query.code}`, options);
	const data = await response.json()
  return data
}

You can then store retrieve and store user information and refresh token to get access again later using this key. Let me know if I can clarify any further for you, or if this helps out.

Hi Kelly,

Thanks for the answer.

Unfortunately, we can’t use client’s token as the application will be installed for all users in the account by admin.

The app we’re implementing is a chatbot that sends users daily reports. And we need somehow retrieve user’s zoomID having only their email.

Is there any other way to call Users API from the Team Chat app(like in Server-to-server OAuth app)?