Skip to content

Instantly share code, notes, and snippets.

@dpawluk
Created September 1, 2017 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpawluk/a2a0444f27d30830c41398d09228e22d to your computer and use it in GitHub Desktop.
Save dpawluk/a2a0444f27d30830c41398d09228e22d to your computer and use it in GitHub Desktop.
example of using app.registered to call a function.
<html>
<head>
<meta charset="utf-8">
<!-- http://garden.zendesk.com -->
<link rel="stylesheet" href="https://assets.zendesk.com/apps/sdk-assets/css/1/zendesk_garden.css" type="text/css">
</head>
<body>
<h2 class="u-gamma">Hello, World!</h2>
<!-- https://github.com/zendesk/zendesk_app_framework_sdk -->
<script type="text/javascript" src="https://assets.zendesk.com/apps/sdk/2.0/zaf_sdk.js"></script>
<script>
// Initialise the Zendesk JavaScript API client
// https://developer.zendesk.com/apps/docs/apps-v2
var client = ZAFClient.init();
client.invoke('resize', { width: '100%', height: '200px' });
client.on('app.registered', init);
function init(context){
//here you can do all the beginning things and even get the context for your app location.
console.log(context);
client.get('ticket.requester.timezone.offset').then(function(){
// no we know we have a connection this should work
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment