Summary
Is it possible to use the Gmail forwarding feature to send (i.e., “push”) via HTTP (GET/POST) to my GAS script URL? (And perhaps include its contents as a parameter?)
Goal/Background
My goal is to immediately process my incoming Gmail instead of, say, using the GAS trigger feature to query and “pull” my Gmail on a periodic basis.
The former method is relatively immediate. Whereas, the latter method creates an expected delay equal to the mean interval time between (automatically triggered) queries to my inbox.
Possible Solutions
1. Gmail Data API
This documentation states Gmail lacks a data API.
2. Atom/RSS Feeds
Atom/RSS feeds still require an aggregator to pull the data from the server and, thus, do not accomplish my goal of a push-only solution to my GAS URL to, then, in turn, trigger my script via doGet() or doPost().
3. IMAP/POP
These solutions are designed for desktop/offline processing of emails and, therefore, do not meet my goals. I need a solution that lives on the web and automates my web-based email checking tasks.
4. High-frequency GAS Trigger
A, say, 60-second trigger interval in GAS does not work because there is a cost to such high-frequency triggers in GAS due to quota limitations. i.e., I don't want to use up that much quota space on this one task because I need it for other stuff.
5. 3rd Party Listeners
I would prefer something free if possible. Someone has suggested Zapier® — which does have a free version. Do these work? Are there others?
Conclusion
Are there any creative ideas out there? Perhaps to point me in a creative direction?
I would even settle for just a way to be immediately notified (programmatically) that I received a new email.
Not possible from Google Apps Script:
Google Apps Script currently available events:
https://developers.google.com/apps-script/understanding_events
Does Gmail have a Data API?
FAQ: https://developers.google.com/gdata/faq#GmailAtomFeed
Looks like IMAP is the only option, not sure if IMAP supports callback.
A trigger can kick off a script every 60 seconds. As you stated before, this puts your average notification at 30 seconds (let's not get started on possible flaws in statistical assumptions).
Another possibility for a more immediate action is to use a service like Zapier.com as a listener. It can listen for new emails in your gmail inbox, apply filters, and initiate a GET/POST to the URL for your Apps Script (make sure it is the newest version published).
I hope this helps. Curious why you need immediate handling of the messages ...
Related
I am using a gmail account to selectively forward incoming mail to the correct recipient based on criteria in the incoming mail. Bear in mind I can't solve this using Gmail filters. I need to run Apps script in order to look up the sender in a database before deciding who to forward the mail to.
I quickly hit a "service invoked too many times" for sending Gmail, which is likely intended to prevent spam mail. However this is not spam and the recipient gmails are consenting and limits are unhelpful here.
Is there any way to remove sending limits between consenting gmails?
You're probably hitting one of the Apps Script quotas. In my experience, Google is unlikely to make exceptions or raise Apps Script limits upon request.
Most of these quotas are per-account, so a workaround that you could try is to run the script from another account once the limit is reached.
Also, the limits of the Apps Script Gmail Service are more restrictive than the limits of the pure Gmail API REST calls or other API libraries, so another workaround could be to write the script in another language and use the API, or if you want to keep using Apps Script you can use REST calls rather than the Gmail service.
Even if you still hit the quotas with the Gmail API there are ways to request a quota increase, while there is no such process for Apps Script. My guess is that Apps Script is intended for smaller projects, but if you're working with a larger volume you're supposed to use the Gmail API instead.
Quotas imposed based upon exceeding the rate not an absolute limit
It may be that you are looping to fast. Because google imposes limits based on an instantaneous rate. So assume you can send 2000 letters per day then that means you can send email every 0.023 second so it send one every 0.05 seconds you will probably stay out of trouble. By the way I don't really know what the quota is.
I was wondering if there is a way to automatically (or on a trigger) delete emails from a Google Group.
I use a Collaborative Inbox Group for archiving automated emails.
I looked at the Google Apps Script overview for Google Groups, but I don't see anything. It only seems like you can do this from GmailApp...
I also read this thread from 2012 but nothing helpful there
Answer:
Programmatically this isn't possible.
More Information:
The GroupsApp class of Apps Script only has read methods available for use - there is not a way of executing any write data using the class - for example deletion of emails.
Emails are sent to everyone in the group when a post is made (as per subscription settings). If you want the Email to be deleted then as you have already pointed out, you will need to use GmailApp to delete it from the recipients' inboxes.
In short: All mailbox manipulation must be done using the Gmail API (or GmailApp).
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Admin SDK component, with the Feature Request template.
We have a chrome extension that posts data back to a Google Apps Script app and I'd like to know if I'm going to hit any limits at Google.
The Apps Script app has a doPost function that takes the information that was passed across and uses appendRow to add the content to different sheets. Very similar to how forms works but allows us to deploy to users (via the chrome extension) and have a better looking UI.
We're wanting to push this out to potentially thousands of users and we expect a few form submissions a day from each of them. Should I be expecting to hit any set limits with this?
I've already taken a look at https://script.google.com/a/netpremacy.com/dashboard but don't see anything that would indicate any limits.
Let me know if you need more info.
There are no published limits at this time. However, the key thing to ask with apps deployed as web apps is that is the App running as you (the developer) OR the users accessing the web app?
If its running as the users, then you are going to be ok with the volume. The quota is fully debited to the end user.
If its running as you, then you need to worry about other quota first - does it send out lots of emails, does it create a lot of documents, etc.
The only exception to quotas is ScritptDb that always consumes the script developers quota.
I am using a script that sends an email whenever a user submits a form. Since the script is using my Google account to send the emails, I have to authorize it and that makes sense. However, my scripts eventually stop working (seemingly)randomly and requires re-authentication. The most recent occurrence happened today, one of my scripts requires authentication even though it states that the last edit happened 4 days ago.
Basically, I understand why I have to authenticate, but what makes me have to re-authenticate?
Scripts that use more sensitive apis like Gmail will force a reauth on every code change. Otherwise, you shouldn't need a reauth unless you use a new api, or if you start writing when in the past you were only reading (basically, if you do something beyond the scope of what was previously authorized).
Changes to the script will require you to re-authorize. And something as simple as adding a space to your code counts as a change. Many times these are inadvertent.
I am running an online free computer science education course website. I use Google scripts to evaluate the student quizzes (I use the MCQ script). Yesterday, there was a spike in visitors to my site. I noticed that the quiz scoring script is no longer sending results to students. I checked the failure notification, and it says "Service invoked too many times for one day:"
Is it because of a quota? If there is a quota, then is there any way to increase it?
My class has more than 800 students, so it is likely that they will submit their homework on the very day I post it online. So, I badly need to increase the email quota. If there is any workaround, that will also be very useful to know.
Thanks in advance.
If you deploy the app to run as the user executing, not as you, then it will run with their quota. However, they will have to click to authorize sending mail, and it will appear to have come from their own account to themselves.
The quotas are shown on the dashboard that can be also accessed through a link in the side panel of the documentation page. I'm afraid you hit quotas for email service.
...
EDIT : Ah, didn't see Corey's answer... smart suggestion of course ;-)
Try using an external API (i.e. Mandrill). Mandrill (it's by Mailchimp, so it's pretty robust) has an easy external API with much larger limits (in the order of thousands).
You can even set the from address so that it wouldn't look spammy (or, really, any different than the normal Google Apps Script send email).
Take a look at Use Mandrill API in Google Apps Script.