What should I request the Gmail API to get email statistics? - google-apps-script

I am interested in getting the number of emails sent and received(in priority inbox) on the current day. Nothing more.
Using the REST API in Google App Script.

GET https://www.googleapis.com/gmail/v1/users/your_email%40gmail.com/messages?labelIds=SENT&q=newer_than%3A1d&key={YOUR_API_KEY}
To get the number of messages received/sent in the last 24 hours, you can use the gmail.users.messages.list API. You must specify the following query: newer_than:1d to only get a list of emails that were recieved/sent in the past 24 hours. You must also specify which label to query in (INBOX or SENT). Please refer to the following screenshot. You can test it out for yourself here.

Related

GmailApp.createDraft() function daily quota?

I need to know if the GmailApp.createDraft() function within Apps Script will come with the daily quota for API usage, which would limit the number to 100/day? The documentation suggests that this function is not an API function, so would another hopefully higher quota apply? The email is not sent, and so I assume that creating a draft does not affect my daily send quota either. Is this correct?
My account is stuck within the 60 day waiting period before my quotas are raised to those of full Business Starter subscription, but I see no reason to believe that this would affect my creating email drafts.
I do not see any quota listed here or elsewhere on the support pages. Does anyone know where I can find an answer to this? Thanks.
createDraft(recipient, subject, body)
Creates a draft email message. The size of the email (including headers) is quota limited.
I would guess it falls under Email read/write (excluding send)
but thats just a guess i dont feel like inserting 20k drafts to test it.

Service invoked too many times per day: email

I have this issue. My google account is G-Suite and I'm entitled to 1500 email recipients per day.
I have calculated the email that I have sent within a day and it adds up to only 221 recipients per day.
13 Recipients * 17 emails per day.
Is there any other issue that may caused this problem? Can it be the time between the execution runs? If so, is there any way to make a gap for each of the execution?
Are you CC'ing or BCC'ing anyone in your script? Gmail counts every CC or BCC as a separate email and thus it counts towards your email quota.
Please note the following part of the documentation:
Note: Newly created G Suite domains are subject to the consumer limit
for the first billing cycle if they have six or more users, or several
billing cycles if they have fewer users. For more information, see the
Help Center page on sending limits.
This would explain why you are temporarily limited to the Consumer quota.
Be also aware of different quota for external accounts.
As I constantly troubleshoot, I have found out that by using Google Groups, the problem went away. I believe the reason for it would be I am technically sending only one email to an address. That email address will then branch out and send to the different email that I have within that Google Group that I have created. After monitoring it for a few days, I do not have this problem anymore.
Thank you for those who have helped me.

Salesforce Marketing Cloud mass email send

I want help from someone regarding the mass email send via Salesforce Marketing Cloud.
For example, I want to send emails to 5000 customers daily. It is a newsletter. Each days the email contents will change. There are 4 dynamic variables in my newsletter. First Name, Last Name, Email and Message.
Which is the option to send mass emails via Salesforce Marketing Cloud?
There are different options like use Data Extension, List, Triggered Send. I used triggered send (I am using PHP fuelSDK ) and it is not sending all the 5000 emails quickly (when I created a triggered send I have selected Email, List, etc). I am calling the Triggered send api 5000 times to send to each emails (It is taking more than 1.30 hours to complete). Also it is not sending email to all the 5000 email addresses. Some failure response I am getting like "Error Code: 24 - Subscriber was excluded by List Detective". I understand this. Some emails I can see "Successfully sent" response in the log. But when I check it in tracking section, those emails are not there. I don't know what is happening here.
Can any one help me to understand the problem?

Google Places API Invalid request

I've started looking into Google Places API recently and have enabled the API through my Google Developer Console. I tested the API through the following URL in my browser (please note that I have intentionally changed my key below):
https://maps.googleapis.com/maps/api/place/textsearch/xml?query=hotel&location=43.683308,-79.614296&radius10000&key=thisismykey478erjr84
Worked fine, I got back the XML, but when I tried it again I got the following:
<PlaceSearchResponse>
<status>INVALID_REQUEST</status>
</PlaceSearchResponse>
Now, as far as I know I'm given a courtesy limit of 1,000 requests/day. I know I did not go over 1000 requests. I figured maybe I'm only allowed a certain number of requests per hour or per minute so I waited.
Next day same problem! And today as well.
Not sure what to do in this case, any advice?
The radius parameter is missing the = separator. Try radius=10000.

Partial GET request for Google Calendar html download

Hi I'm working on an Arduino project and I'd like to display the next event from a Google calendar on a small display. I want to know if there's a way to limit the size of a HTML request from Google. Right now when I do the request I'm getting my full calendar's data. This significantly slows down the time it takes to get the event. I tried using a GET request and Range bytes 1000-3000 but this doesn't seem to work. Does anyone know any workarounds for this without going through Oauth?
You want the "maxResults" parameter and you may also like to limit the fields returned using the "fields" parameter as well. Check the events > list docs for details.