How to properly embed schemas into email? - google-app-engine

I am trying to create a sample application that will use schemas embedded into email (particulary, ReviewAction described in the end-to-end example by Google).
I have created an google-app-engine application, deployed it as described. It works as expected, excluding gmail doesn't add any buttons to the email.
An email is being send to the same Google account that has created the application (From and To headers of the email are the same).
What I am doing wrong in embedding schemas into email?

ReviewAction hasn't rolled out to all users yet and it is probably going to take the whole next week before it is available to test. Sorry for the delay, I'm sure you understand it takes time to roll out features to all Gmail users and to all Gmail servers.

Related

google calendar javascript api: how to create a calendar in my google account and not in oauth authenticated user?

I'm thinking on my scenario and there is a point I cannot manage to bring to a valid approach:
I have a web app where users log in and, among other things, they can create calendars. If this calendars are marked as publics, all users can see them.
I want them to be able to sync the calendars with their google calendar account. I have this already implemented using gapi.
The problem is when, after a while, any user updates an event of a calendar which other user had synchronized before. He is not going to see the changes in his google calendar, as I'm not able to send him updates since he is not logged into the app.
So, my idea was to create all calendars in our own account, and whoever wants to have it in their google account, just have to subscribe to it. I would do that with gapi.acl lib.
What I don't know how to do is: when the first user wants to syncronize the calendar, it should first be created in our own google account, so that the user will be able to subscribe to it...
But how do I change the account where to create a calendar using gapi?
Maybe it is a stupid question but I cannot manage to find out how to do it.
Thanks in advance!!!!
But how do I change the account where to create a calendar using gapi?
You cant, what you are trying to do is get offline access to a users Google calendar data. OffLine access means that your application can access the users account when the user is "offLine" as in not there. This being a fully automated functionality of your application.
You need to request permission of the user for "offline" access once that is granted you are given a Refresh token the refresh token can then be used to request a new access token when ever your application needs even if the user is "offline".
Your problem being that JavaScript is client side this means that the code is running in the users browser. Due to major security concerns offline access is not something you can request using JavaScript you need to use a server sided programming language.
Maybe it is a stupid question but I cannot manage to find out how to do it.
I don't think its a stupid question but I do think there are some major wholes in your applicating design.
You first need to think of if users really want you writing to their personal calendar account.
Then you need to consider weather or not you want to be writing and sharing your personal calendar with a bunch of unknown users.
There are also major limitations to the number of writes or inserts you can make to a single calendar per day so storing everyone's calendar data in your own calendar is going to not only messy but it may end up overloading your request limit.
Once all that is added up have you considered the verification process this application is going to have to go though. How will you justify your application to googles security review, I am writing to a users calendar, I am storing users calendar data in my own personal calendar ....

How do I authenticate users of a web-app to access GCP data relevant only to them?

I have spent 3 days researching this problem and cannot find a solution or similar use case that shows how to solve the problem, so any pointers would be greatly appreciated.
I am creating a web-app that uses Google Cloud Storage and Bigquery. A user registers on the web app and then can upload data to Cloud Storage and Big Query. Two users could be from the same company and therefore should be able to view the same data - i.e. Jack and Jill work for company A and if Jack uploads a massive dataset via this app, Jill should also be able to view it later.
Another scenario will be I have two completely separate clients with users using this web-app. If users from Company A upload data, users from Company B should not be able to view Company A's data, and vice versa. But users from the same company should be able to view the data within their company.
Currently, I have an app that works for a single company. This has a React front-end that uses Firebase for authentication. Once the user is logged in, they can use the app which sends off API calls to a Flask back-end that does some error checking and authentication checking and then fires off an API call to GCP. This uses a service account and the key is loaded as an environment variable in the environment in which the Flask app is running.
However, if Company B want to use the app now, both Company A and Company B will be able to see each other's data and visualize it through the app. In addition, they will be sharing a project (I would like to change this to allocate billing more easily to have each client have their own project).
I ultimately want to get this app onto Kubernetes and ensure that each company is independent of each other, however, do not want to have to have separate URL's for every company using the app. Also, I want to abstract GCP away from the client. I would prefer to authenticate a user based on their login credentials and then they will be given access to their GCP project (via my front-end) accordingly.
I thought about perhaps having separate service keys for each client and then storing the service key info in Firebase, while using the respective keys for API calls but not sure this is best practice. It is however the only strategy I can think of.
If anyone could provide some help or guidance it would be very much appreciated. This is my first GCP project and have not been able to find any answers on GCP, SO, Google Groups, Slack or Medium.
Thanks,
TJ
First if all, welcome on GCP! It's an awesome platform, very powerful and flexible. But not magic.
Indeed, the use case that you describe is specific to your business logic. GCP provides told for securing access for user and VM(through service account) but not for customer. Here you have to implement your own custom and authorisation logic, with a database (I don't recommend bigquery for website, the latency is too high) to list three users, the companies where they work, the blobs of each company...
Nothing is magic and your use case specific.
If you want to discuss more about which component to use and to start, no problem. Let a comment.

Send email from a Google Apps nickname on Google App Engine

I'm trying to set-up a business website using App Engine. Previously, I had prototyped the site using my personal gmail account, but now I've purchased a domain name and have set-up google apps. So far, the only hitch I've encountered is getting my contact form to properly email people who try to contact me. Originally, I was using this code:
from google.appengine.api import mail
sender_email = "Admin <admin#example.appspotmail.com>"
mail.send_mail(sender_email, contact_email, subject, body)
I'd like to change sender_email to guru#example.com where guru is a "nickname" for my email account on Google Apps.
When I try to add guru#example.com I can receive an invitation email but can't add the nickname as a separate account.
Is there any way to do this without adding a new mailbox to my Google Apps account?
You will need to add a new mailbox.
I spent some time researching this issue and found no work arounds. Outside of possibly using Python E-Mail library and my initial look into it seemed more effort than it was worth for my applications. You will also need to host an email server somewhere and configure your mail exchange records in DNS properly.
If you do write your own email sending function and you're changing the sender your message will likely be flagged as spam.
Also if you plan on processing or receiving mail using your App Engine app it will need to be addressed to user#myapp.appspotmail.com as well. Thus negating all that extra effort to keep from using appspotmail.com

Google Application Engine For Sending Emails

I have a newsletter with 13k subscribers. I would like to use Google to send the newsletter instead of the free edition of mailenable I am using currently.
The main thing that has put me off is the 2,000/day sending limit as it would take a week to send out a bi weekly newsletter which may have time sensitive information in it.
I saw a post here that said you can send over the 2,000/day limit if you use the GAE.
I went to the GAE page and had a look at the limits and it does say that you can make 1,700,000 email queries. However, I called the Google apps sales team and they said Google says anything above 2,000 emails is spam and has no legitimate purpose (I had the feeling though that the person I was talking to was poorly trained and had no idea what the GAE was).
So would I need to create my own google app that acts like a SMTP server and uses the GAE to send the email? Would this be the same as sending through Google Apps, i.e. DKIM header added and trusted IP?
Any help anyone can give me is greatly appreciated.
Many thanks in advance.
From my experience GAE is a very bad platform to send bulk emails.
For a long time it didn't support DKIM or Sender Id, its hard to mange bounces, and on top of everything you need to write your own framework for bulk sending using tasks or backends.
The cost of instances time for sending those emails might even double your cost (in $$$) for sending the newsletter.
We choose to go with Mailchimp which is IMHO the best tool for sending bulk newsletters.
Billed applications can indeed send more than the default daily free limit of emails with App Engine. Once you have enabled billing, you can choose how much quota you want to dedicate to your app, including email sending.

Adding Instant Messaging (possibly XMPP) to my website on AppEngine (without using Google Login IDs)

I have developed a dating website built on top of the Google App Engine, to which I would like to add instant messaging, and possibly/probably audio and video conferencing.
Given that the users on the website do not want to share their personal details or real contact information, I am handling all of the login information and sessions without assuming that the clients have (or even want) a google account ID or any other login that is associated with their real identity.
I would like to hear suggestions on how I could go about adding instant messaging to my website given that I cannot just directly access Google Talk or some other existing service.
Would it make sense to use XMPP for this, and if so will Google Talk or any other XMPP service provider allow me to register new user accounts without manual intervention (ie. after a user is registered on my site, automatically register them with the XMPP provider)? Or, if not, perhaps I can use a single google ID with Google Talk with a different resource identifier for each user (me#google.com/user1, me#google.com/user2, etc...), and send messages between the different resources? Could this work, and/or would having thousands of simultaneous connections to a single account get me banned from Google Talk?
Perhaps some kind of AJAX based solution might make more sense given the fact that users are already registered on my website, but are not registered for an XMPP service?
Any suggestions about how I might approach this problem would be greatly appreciated.
Kind Regards
-Alexander
Text chat is the easier problem. You can do either with or without XMPP. Without XMPP, you'll be building a Facebook chat type client on your pages that sends messages from each user to the app, and the app then shows then on the recipient's screen.(The client can be polling, or use comet when it comes out). Check out olark to see how this works.
Once you build code to use the app as a switchboard that routes the correct message to the correct person (anonymously, maybe), you can port this easily to XMPP if you require. Both parties add you.dating.site#appspotchat.com to their buddy lists, and you send all messages from girl#site.com to guy#site.com and vice-versa. (assuming a heterogeneous site.)
Audio and video, I have no clue how to do without sharing details between the parties :-/

Resources