Zendesk API v2 migration - zendesk

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

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.

Related

Can I use Google Tag manager to track local file activity? (non hosted interactives)

We have several interactive kiosks with files that run locally off of the hard drive. They are not "local" hosted, no web server involved. We have internet connectivity. Can we track user interactions with Google Tag Manager? I have read a few posts that seem to indicate it's possible, but the set up has changed dramatically since they were authored.
We have our GA and GMT setup, with the appropriate scripts embedded within the local html index file. We have set up a container, and several tags and triggers for simple tracking of page views. But there is no live data coming into my GA dashboard. I am sure I am missing steps if this is possible. Any help much appreciated.
Hoping I am headed right direction here - but still no tracking - where do I get a clientID to manually pass in? Thank you!!!
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXXX-X',{
'storage':'none',
'clientId': 'XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX'
});
</script>
Your question is about GTM, but it is much more likely that your problem is with Google Analytics. There is nothing that prevents GTM from running in a local file (unless you use a very old GTM snippet - I think before GTM switched completely to https, Google used an url without protocol, that would need to be changed), but Google Analytics will not work in a default installation if it cannot set cookies (which in a local file it can't).
At the very least you would have to set the "storage" field to "none" in your GA tag or GA settings variable, and then pass in a client id manually (in a kiosk it is rather hard to determine when a new visit starts, so maybe you could set a different client id every time users return to a home screen or something like that. Or you just live with the fact that everybody is the same user in GA).

Edit or forward an existing mail into Gmail Compose Window

I have a Chrome extension which adds new functionalities to the Gmail interface.
I'm trying to create email "templates" which have a default header, footer and signature (using html, images & css). I want to open these templates in order to edit and send them, just filling the actual content of the email.
I was wondering if there is any way to open these emails directly into the Gmail Compose Window or something like that. Maybe there is a parameter to do this using the URL, like: https://mail.google.com/mail/?view=cm&fs=1&id=xxxxxxx.
I've tried loading the template using the body parameter, but it seems that it doesn't support html.
Any ideas?
Finally, I've found a way to open a mail directly into the "Compose" Window, ready to be edited and sent. It's so simple that I can not believe it takes me 2 days to figure it out:
Just use the url:
https://mail.google.com/mail/u/[accountNumber]/?zx=#[tag]?compose=[MailID]
accountNumber is useful if you have two or more accounts at the same time
tag its the mail list that you want to see behind the compose window (ussually inbox).
MailId ... well, the Gmail Message ID.
For instance, https://mail.google.com/mail/u/0/?zx=#inbox?compose=14bbb0dae14fec1f will open the inbox of your first account with a Compose Window opened and pre-populated with the e-mail data.
There is already a feature called "canned Response" in current gmail compose window which is probably solving the same problem that you are trying to solve with your extension.
well I am not sure URL has html support or not but I think it should not support it to protect user from cross-site scripting attacks.
you can also consider Gmail rest API if you want to compose gmail message with your own custom template but using this you may have to do lots of things from scratch.

Meteor.JS YouTube Auth and Data

So what I've got now is hosted at http://exonia.meteor.com/ -- I've got Google authentication all working, and I've got the two YouTube scopes I want added and working as well. However, when I try to access any of the data from the YouTube API in the Users Collection, the only thing I have is the full name of the user, from their YouTube Profile.
How can I access the YouTube data?
EDIT: I've now deployed to the domain mentioned above, my apologies--was deploying to a custom domain and forgot about that one.
If everything is going as intended, you should have access to the Youtube information in the server. If that's the case, then you need to tell Meteor to also expose that information to the client by publishing it (only basic info is published by default).
For instance, if you want to add some extra fields to the user object from the data you've received from Youtube, do something like this:
Meteor.publish("extra_fields", function() {
return Meteor.users.find(
{_id: this.userId},
{fields: {fieldYouWantToPublish: 1}} // 1 indicates you want to include that field
);
});
Meteor will automatically merge the requested fields into the user object for you. Don't forget to subscribe to it!

AngularJS - How to fetch PDFs (or other binary files) from rails backend?

I'm writing a toy application to get acquainted with AngularJS. This application has a Rails backend.
I don't know how to make the client side angularjs app, deal with a PDF that the backend sends when hitting a particular URL (http://localhost:3000/contacts.pdf)
When typing the above mentioned URL straight in the browser, the server replies with a PDF and the browser asks what to do with it (download or open).
When the same thing is done via the angularjs app, I can see the file gets returned in the response. And that's where I'm stuck at.
How can I replicate the same behaviour within client side app?
Thanks for your help
One way is just use an anchor tag in HTML and put the link as a controller variable ie. Download and in controller put $scope.link = "http://localhost..."; (or array if requiring multiple links).
If this is not what you want, please add further clarification.

How does Facebook pull website data when it sees you've typed a URL into a wall post?

So I'm writing a post on my wall and type a URL into the main body of the post. As soon as I finish the URL, Facebook creates a little section underneath which has the title, description, and an image from the url I typed.
Without getting too indepth, how is this done and what is the best way of make something similar myself?
jQuery (or some other framework that lets you do Ajax easily) to communicate between browser client and webserver
PHP/ASP.NET/Python (or some other scripting framework on the backend) to fetch the url
Facebook also has a meta data specification you might be interested in, to let developers further define what gets shown in a Facebook page.
I believe Facebook is written in PHP. And PHP does this easily.
FOpen can be used to access files on other sites. There are other functions but this will get you started. Then it's a matter of parsing the html you get from the url to get what you want.
http://php.net/manual/en/function.fopen.php
You have a couple choices. You can fetch it using Ajax from the client; or you can fetch it from your server.
If doing it from your server in asp.net then you need to use HttpWebRequest.
FB does an asynchronous JavaScript call to fetch that data without reloading the window you're on. Lookup ajax and libraries like jquery do this: http://api.jquery.com/category/ajax/

Resources