How to access Zoom API with chat bot?

Using this template helps us debug your issues more effectively :slight_smile:

Description
I have created a chatbot Application and able send and receive messages using grant type client credentials. but could get any authorisation code to access Zoom API.

Error
{ code: 200, message: ‘Invalid api key or secret.’ }

Which App Type (OAuth / Chatbot / JWT / Webhook)?
Chat Bot

here is the main code:

app.get('/authorize', (req, res) => {
    res.redirect('https://zoom.us/launch/chat?jid=robot_' + process.env.zoom_bot_jid);
});
app.post('/bot', (req, res) => {
    getChatbotToken();
    function getChatbotToken () {
        request({
          url: `https://zoom.us/oauth/token?grant_type=client_credentials`,
          method: 'POST',
          headers: {
            'Authorization': 'Basic ' + Buffer.from(process.env.zoom_client_id + ':' + process.env.zoom_client_secret).toString('base64')
          }
        }, (error, httpResponse, body) => {
          if (error) {
            console.log('Error getting chatbot_token from Zoom.', error)
          } else {
            body = JSON.parse(body)
            console.log(body.access_token);
            sendChat(body.access_token)
          }
        })
      }
      function sendChat (chatbotToken) {

        request({
            url: 'https://api.zoom.us/v2/users/',
            method: 'GET',
            json: true,
            headers: {
              'Content-Type': 'application/json',
              'Authorization': 'Bearer ' + chatbotToken
            }
          }, (error, response, body) => {
            if (error) {
              console.log('Error sending chat.', error);
            } else {
              console.log(body);
            }
          })
      } 
});


Thanks rohith

Hi @rohith,

If you’re calling the Zoom REST APIs, you will need to use a separate access_token from an OAuth app with specific scopes, retrieved using the authorization_code grant type instead. A Chatbot app will only be able to access certain Chat related APIs.

Let me know if this helps to clarify,
Will

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.