Search code examples
zendeskzendesk-api

Zendesk API v2 migration


I'm currently migrating my private app from Zendesk to v2 version of the framework. Basically, I'm showing one page from my application inside Zendesk APP. Since now in Zendesk V2 an APP is an IFrame, I've put my end-point directly on the manifest.json file. My question here is, how can I get the email of the ticket client-side? I need the email and avoid a refresh to my page because I do a lot of things when the screen is rendered and after a reload ZAFClient.init seems not to be working correctly.

Thank you


Solution

  • A simple example app for what you'd like to achieve would be:

    Requester email: <span id="requester-email"></span>
    
    <script>
      client = ZAFClient.init();
      client.get('ticket.requester.email').then(function(data) {
        $('#requester-email').html(data['ticket.requester.email']);
      });
    </script>
    

    The above code assumes jQuery is already loaded.

    I recommend looking at https://developer.zendesk.com/apps/docs/developer-guide/migrating for further info.