Gmail API Tutorial only returns Labels - gmail-api

I've recently been trying to implement the Javascript quick-start guide on the official Google Dev page, which can be found here:
https://developers.google.com/gmail/api/quickstart/js
The example is meant to read your Gmail inbox and display the last 10 emails on your html page. I've gone through the example but after I grant permissions in my web browser, I only see a list of the "labels" present in my inbox with no emails/email content. I have created a new custom label in my Gmail inbox and this new label is view-able on my html page, which to me suggests that my connection to the Gmail API is fine.
However, I have not used Python like the example suggests. My html file is currently being hosted on 000WebHost so I figured I don't need to use Python. The reason I came to this conclusion is because the tutorial explains that Python is used to host a web server, as I'm using 000WebHost I think I don't need to host this web server.
This could be my issue if I've misunderstood what Python is really needed for here?
Other than that, I'm wondering if there are any other glaringly obvious issues to someone experienced with the gmail API?
Any advice would be appreciated.

Related

React Native Upload to YouTube

I am trying to upload a video that I take locally using react native camera and then send it to youtube for processing and then want to display that video on a react.js web dashboard.
We have tried using fetch-blob to upload the video and cloud firestore to store the video. We are not sure at a high level on how to go about the uploading to youtube. I know there is upload docs, however can we physically go about uploading straight from our react-native project to youtube, or would we have to upload to a database such as firebase and then use a cloud function to send it to youtube? Has anyone attempted this? The other alternative is that we can upload to S3 and then use AWS cloudstream to play back but that seems like overkill if there is a simple youtube upload that we can use. Do we have to authenticate a user to youtube before it would work? We do not want anyone having to log into a google account. We are hoping just to have an application created with youtube that we can upload to our channel.
Thank you!
Answer
You can absolutely upload a video to YouTube in many different ways. You mentioned a few options and I will line out how those could work for you.
Do we have to authenticate a user to youtube before it would work?
You will have to authenticate to YouTube in order to upload to a YouTube account. You could very well have one account for your app to use and when your users make videos the app could upload them directly to that account. I do highly advise against that though. Google is not very forgiving and the second someone uploads something to violate Google Policies I suspect you will be banned.
That leaves me to believe the best way here would be to use Auth0 to authenticate users and upload to their accounts. Otherwise maybe look into other options.
Possible Options
Option 1
It might be possible to upload all the videos to one YouTube account and make them all private. Then retrieve those videos and play them on your own site. Possibly something like that could work but it is probably a long shot. That could at least keep you from getting banned because of a user violating Google Policies.
Option 2
Another option would be to make one YouTube account. Save the videos to your server when the users creates them from your mobile application. Then have a waiting period for the video to post to YouTube in order for you and your team to have time to approve them.
At least this way you can use YouTube and have one account, but not take the chance of any repercussions from the videos people are posting.
Problem
How to upload a video from your mobile app using React Native to youtube.com
Solution 1
Upload straight from React Native. You can Use the Google APIs to upload directly to youtube. Google has an extensive API. You will have to create a Google API account and make sure to activate the APIs you want to use. Here is some information I found using the Google Javascript API to work with Youtube.
If you go to this link you can see some information on the scopes of this API.
Here is one scope mentioned on that page.
https://www.googleapis.com/auth/youtube.upload
Using Gogoles APIs you can upload videos directly to the youtube account.
Solution 2
The second solution is to post the video to your server, then once it hits the server use some other server side language to interact with Google's API. This could come in handy for other reasons. Like if you are better with a language other than JavaScript. For example Python might be your favorite language. In that case here is a Python Github repo that does just what your trying to do.
You could very well implement the repo mentioned above to your server and post the video you create from your phone to the server. Allowing the Python script to handle posting the video to YouTube.
Side Note
I do not think Firebase or really any database is necessary for the task you are trying to accomplish. Unless there are other requirements to your problem you have not mentioned.

Loading salesforce info to my local host site

just as a heads up I am 100% new to salesforce, only hearing about it yesterday. I have been assigned the task of writing an API to pull customer emails into our new website that is currently on my local host. I know the sobject name of the emails is a string called emails. However I think I am missing some major fundamentals despite reading a bunch of salesforce documentation pages.
When I log into our site I do not see a database (like I would have expected) I just see the many objects for our cusomters. I just can't seem to understand where I am supposed to write this "api" that I was told to do, or how to use it once it is written somewhere. I apologize for having no clue what I am doing regarding this, can someone please explain the basics of pulling data from it (currently on windows running apache if this matters, using HTTPS).
Probably, you will need to implement REST API services on Salesforce side and work with them from your app. If you are totally new with Salesforce just try to read Learn Salesforce Basics or use Trailhead interactive courses.
When you will understand a bit SF, you will need to learn how implement Salesforce REST API, here is the related documentation.

Google Calendar Api Documentation better than the official V3

Please I want to create Event in Google Calendar API but the documentation official is BAD I cant use it .. And someone here who can help me please!! Sorry with my english but I speak spanish!
I agree...
This helps a bit: Google Calendar Events
Depending on the process you are using, there are few examples for using asp.net and the service account option. I successfully created events via service account with granting domain-wide access. With this you just need to create an app, then service account for the app and follow the domain wide delegation steps on the google documentation pages. This option is great if you have an app that needs to create events without having to authenticate the user.
For working code and more info you can see what I used at-
Google API Calender v3 Event Insert via Service Account using Asp.Net MVC
What is "bad" about the documentation? (Don't just complain; provide actionable feedback.) In the v3 docs, check out the reference section on creating events. There is even sample code in Java, Python, PHP, and Ruby to help get you started just below the reference. In addition, below the sample code is the APIs Explorer where you can issue requests with appropriate payload to the API and see the HTTP response to ensure you're calling the API correctly and receiving the data you requested. If there's any additional way for us to improve the docs, please let us know!
UPDATE (Sep 2015): I created a blogpost and video that walks through some pseudocode (well, it's Python) for creating events. There are examples in most other languages too.

Can you import Selenium Web driver into the Google App Engin

I am sort of new to app development, so this may sound like a stupid question. The company I am working with is trying to get ride of most of there IT infrastructure, so that they don't need any more servers. I have been asked to develop a program that takes information from a google spreadsheet and then with this information puts it into a web browser. I am Planning on using Phyton and selenium web driver. Will I be able to install selenium if i host the application as a Google app engine?
The Reason I want/need to use selenium web driver is because I need to put the information from google into a legacy system. The only way to put information in the system is to mimic a user putting the information in manual in a web browser.
Thank you,
Kai
I don't understand what you think Selenium will be doing here. It seems a very strange way to want to get information from one Google property into another.
Google spreadsheets have a perfectly good API that allows you to read the data from your app and display it to users.
Edit after question update Well, now I don't see what you need GAE for. That is for hosting and running websites, and you only seem to want to enter data into an existing website. That's not what it does at all.

Setting Google Talk status (with authentication) from Google App Engine

I'm trying to build a site that updates users' Google Talk statuses from Google App Engine using the built in XMPP Python API (or a third-party one, if one works better than another). I've been looking around for some examples or docs explaining how I would go about doing this, but nothing I find seems to offer a fully functional solution.
App Engine's XMPP Python developer docs suggest that updating a status can be done through the send_presence() method (see here):
xmpp.send_presence(to_jid, status="My app's status")
But, how would this be authenticated? Wouldn't I have to send the users password with the request? (Ideally, I'd like to do so using OAuth as suggested here.) Am I misunderstanding something?
Please excuse me if I'm missing something obvious, here. I'm pretty new to both Google App Engine and XMPP. Unlike a lot of examples I've found online, I don't want to create a chat "robot"; I merely want to change an existing user's Google Talk status. Thanks in advance for any pointers!
You can't change someone else' status using the XMPP API.
You can use the XMPP API to represent yourself, or your users (see the description of XMPP addresses in the GAE XMPP API docs).
You cannot send messages or update the status of a gmail user.

Resources