Contact access from ticket side bar

7 Comments

  • Cheryl Lane

    Hi,
    You can get details for a user using the users API https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user . To access that from the ticket sidebar location, you'd use the client.request method, like this:

    const user_details = await client.request(`/api/v2/users/${contactId}.json`)

    Then you can get the details you're looking for from that object.
    Hope that helps,
    Cheryl

    1
  • Himanshu Sehgal

    Hi Cheryl,

    Thanks for your reply. It works fine ! But I don't understand how. Can you please explain a bit that why no Authorization header was needed for this api request ?How it worked without any api token or any sort of authentication ?

    0
  • Greg Katechis
    Zendesk Developer Advocacy

    Hi Himanshu! When making an API request to the same account that the ZAF app is installed in, and when using our `request()` method, we use the browser's session cookie for your instance as we document here.

    1
  • Cheryl Lane

    As Greg says, requests made by client.request will use the existing Zendesk authentication, so you can call all Zendesk apis this way without having to specify a domain/subdomain or manage any authentication credentials. As you've seen, very handy!

    0
  • Himanshu Sehgal

    Hi Greg and Cheryl,

    Thanks for the clarification. This indeed is quite handy. However, now I am facing a little bit different issue related to the data in the response of the /users api. As shown below, you can see I have saved 3 contact numbers for the user :-

     

     

    BUT when i am calling the /users api,  I am getting only 1 phone number in the json response :-

    I need to know why is this happening , and Is there any way to get all the phone numbers of the contact ?

    Thanks !

    0
  • Himanshu Sehgal

    Hi Anton,

    Thanks for the solution! Cheers!!

    0

Please sign in to leave a comment.

Powered by Zendesk