API Endpoint(s) virtual_agent/report/engagements ZVA
Goal
Build a script that call virtual_agent/report/engagements
API to generate reports. This script needs to run by itself without user input.
According to link above, zva_report:read
Scope is required but it is only selectable under User managed OAuth app, and OAuth requires user authorization OAuth.
- Is there another solution that can achieve my goal instead of using OAuth app?
- Alternatively, I tried using below code and it has error
{'code': 100, 'message': 'Invalid Access token'}
Is this not a valid approach as I should follow step 1 to get user authorization first?
import requests
# made up credentials
client_id = 'uzsfdsajRl_v9r_dfs133A'
client_secret = 'nKduriRfaWSSfapIeblYSafdaImXRe'
# Obtain access token
token_url = 'https://zoom.us/oauth/token'
token_data = {
'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret,
'scope': 'zva_report:read'
}
response = requests.post(token_url, data=token_data)
access_token = response.json()['access_token']
# Make API call to the Zoom Virtual Agent API
api_url = 'https://api.zoom.us/v2/virtual_agent/report/engagements'
headers = {
'Authorization': f'Bearer {access_token}'
}
response = requests.get(api_url, headers=headers)
print(response.json())
Thanks for your help!