facetoe / zenpy

Python wrapper for the Zendesk API
GNU General Public License v3.0
336 stars 159 forks source link

Zendesk Chat API #466

Open zmahoor opened 3 years ago

zmahoor commented 3 years ago

I'm having trouble pulling chats using the client.chats function. It gives me the following error. I initialized the Zenpy client with a chat API token which I'm certain it's correct and authorized to pull from https://www.zopim.com/api/v2/chats

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/anaconda3/lib/python3.7/site-packages/zenpy/lib/api.py", line 321, in __call__ return self._query_zendesk(self.endpoint, self.object_type, *args, **kwargs) File "/opt/anaconda3/lib/python3.7/site-packages/zenpy/lib/api.py", line 257, in _query_zendesk return self._get(url=self._build_url(endpoint(*endpoint_args, **endpoint_kwargs))) File "/opt/anaconda3/lib/python3.7/site-packages/zenpy/lib/api.py", line 112, in _get response = self._call_api(self.session.get, url, timeout=self.timeout, **kwargs) File "/opt/anaconda3/lib/python3.7/site-packages/zenpy/lib/api.py", line 149, in _call_api self._check_response(response) File "/opt/anaconda3/lib/python3.7/site-packages/zenpy/lib/api.py", line 288, in _check_response raise APIException(json.dumps(_json), response=response) zenpy.lib.exception.APIException: {"error": "Unauthorized", "description": "The server could not verify that you are authorized to access the requested resource"}

wowkin2 commented 2 years ago

Same issue here. @zmahoor have you found a way how to resolve this?

mesajidiqbal commented 2 months ago

@zmahoor @wowkin2 You need to generate a separate OAuth token specifically for accessing chats, as outlined in this article. The regular Zendesk token won't suffice for this purpose.