SendGrid Email Activity API rate limit - sendgrid

In testing code that uses the SendGrid Email Activity API, I have received "too many messages" errors. I have examined the "rate limit" response headers and it appears that I am being limited to 10 requests per 5 minute block in the day. That is, the first 5 minutes of every hour can have 10 requests, the next 5 minutes can have 10 requests, etc.
I asked SendGrid support about this. The first response was pretty generic, but seems to indicate that the threshold is correct and says I really should be using webhooks to get the status. I haven't found anything in the documentation saying this and I haven't seen anything the specifies what the rate limits are.
For those of you using the Email Activity API, are you limited to 10 requests per 5 minutes? If yes, what do you do with the API?

Here's an snippet of what I ended up using with requests, tenacity and ratelimit:
from ratelimit import limits, sleep_and_retry
import requests
import tenacity
#sleep_and_retry
#limits(calls=2, period=60)
#tenacity.retry(
retry=tenacity.retry_if_exception_type(requests.exceptions.HTTPError),
stop=tenacity.stop_after_attempt(10),
wait=tenacity.wait.wait_fixed(60),
)
def _call_api(headers, params):
response = requests.get(
"https://api.sendgrid.com/v3/messages",
json={},
headers={},
params={},
)
try:
response.raise_for_status()
except requests.exceptions.HTTPError:
logger.info(f"Request failed {response.headers}, retrying in 1 minute")
raise
return response

I received a response from SendGrid support that says:
Your findings are correct in that we do limit this endpoint to 10 requests per 5 minutes. This is a hard limit that we do not have the means of raising. The Email Activity Feed as well as the Email Activity API endpoint are meant for troubleshooting specific issues and attaining detailed message metadata.

I previously found the rate limit to be 10/5min but it appears that SendGrid have changed the rate limit to 2 requests every 60 seconds sometime in the past week. Can anyone confirm this?
I'm using the webhook to report non-delivery back to my application but I also need to use the activity API to resolve async bounce notifications. Async bounces are when a destination mail server accepts a message during the smtp session but subsequently sends a bounce notification email. When this occurs, SendGrid do not provide the detail of the bounced message in the webhook and the message is incorrectly reported as delivered in the SendGrid app. When asked, they respond that there's nothing they can do about it, even though I have explained to them how I use their activity api to resolve this.
I pay extra to use the activity API to fix a problem that they should address themselves, so I'm very frustrated that they apply such restrictive rate limits, then change them without notice.

Related

How to fix the quota problem of email wotj G Suite account?

I have some a script with trigger set up to send emails daily with GSuite account (about 10 triggers to send about 15 email in total per day, average 6 recipients/email.
However, last few days, I got the alert:
Exception: Service invoked too many times for one day: email
when running the script by trigger or by manually.
I do not think I hit the quota of sending email daily of Google. This morning, when I check the quota remaining by function MailApp.getRemainingDailyQuota(), I only get 4 email remaining. I do not know what happened.
Is there anyone could please help me to solve this problem?
This is the alert I receive:
Your script, AutomaticSendingEmail, has recently failed to finish
successfully. A summary of the failure(s) is shown below. To configure
the triggers for this script, or change your setting for receiving
future failure notifications, click here.
Start Function Error Message Trigger End
6/13/20 3:59 PM send_overtimerequest_email Exception: Service invoked too many times for one day: email. time-based 6/13/20 3:59 PM
Sincerely,
Looking at the page for Apps Script quotas it does specify that the limitations per day is counting recipient (100 recipient/day), so in this case you have no much option. Make sure that you are using the correct account because the limitation for G Suite accounts are 1500 recipient/day. Also check out if this may be applying to you right now:
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.
A workaround that I would suggest is to have a service account and use Domain Wide Delegation to impersonate and user then make use of the Gmal API

Firestore: "Exceeded quota for veryifying passwords"?

Hi I got this error in one of my ETE tests which exercises login functionality and start up behavior for my angular app.
The appears to be triggered by logging in using
await this.angularFireAuth.auth.signInWithEmailAndPassword(uname, pw);
where angularFireAuth is an injected instance of AngularFireAuthfrom '#angular/fire/auth';
I checked the Firestore quotas here but I can't find a reference to a quota for verifying passwords. Can anybody point me to what the quota is?
The console error reported looks like this:
zone-evergreen.js:659 Unhandled Promise rejection: Exceeded quota for verifying passwords. ; Zone: ProxyZone ; Task: Promise.then ; Value: u
The problem resolves after a few minutes and then test runs as expected.
I have found the message you are receiving being handled in this github thread.
Here are some of the important comments from the thread:
For the error you are facing "Exceeded quota for verifying passwords", this usually happens when one sends requests for verifying passwords or password login requests too many times at once (more than 20 requests per second per IP address or 25 requests per 10 min per account). When we get a huge amount of requests in a short period of time, the limit is applied automatically to protect our servers.
This is an internal quota (regardless of pricing plans) enforced by Firebase Authentication to prevent abuse when making authentication requests, for this reason the quota can change without notice.
In order to avoid triggering this alert, you can use a different IP address or
back off the number of requests per minute to something like 10-20, to avoid triggering the automated abuse detection.
If you are sending too many requests in a short period of time from the same IP address, then there is an expectation that you will get throttled at some point. This may prevent you from getting successful integration tests but there is a security benefit that comes with that. The easier it is for you to test, the easier it is for malicious scripts to be written too against your project. We have similar integration tests in other firebase auth libraries (client and admin) and we try to work with the limit.
If you have a legitimate need to increase the limit, then you can file a bug with support and make a case for that. You could even file for a feature request to whitelist calls from certain IP addresses.

Facebook Graph API Rate limit for development

I have a Facebook Application in development mode that shows as having 3 daily_active_users. From my understanding of the Graph API documentation, I can make 200 * daily active users = total request per hour, thus, I should be able to make 600 requests per hour
I am then making a Test User and trying to create a page via the accounts endpoint:
https://developers.facebook.com/docs/graph-api/reference/user/accounts/#Creating
This goes well for a single request. I then tried to script this, with 2 second timeouts in between each request, and tried to create 100 pages. After about 10 requests, I get the following response from the Facebook API:
{"error":{"message":"We limit how often you can post, comment or do other things in a given amount of time in order to help protect the community from spam. You can try again later. Learn More","type":"OAuthException","code":368,"error_data":{"sentry_block_data":"...","help_center_id":0},"error_subcode":1390008,"error_user_msg":"","fbtrace_id":"..."}}.
It states that my request is being rejected due to hitting some kind of limit, but what is this limit? I can't find it in the documentation anywhere. Is there a limit to the number of pages I can create with a test user per hour/day?

Why is my mails staying in “backlog” of Mandrill?

at previous hour we reached the number of maximum limit of sending emails per hour which is not surprising since we know our limit per hour to send. However, after an hour passed I assumed that the rest of the emails will be sent automatically. It did not work that way. Now I have over 800 per hour to send and I sent 0 in this hour, at the same time, I see that 139 emails are backlogged from previous hour. Could you please help me how can I send those?
For everyone with a new account (and not over the hourly threshold) and still getting this problem, Mandrill can sometimes wrongly think your account is sending suspicious activity.
To check if this is the case go to the mandrill dashboard and in the bottom left click support. There should be an alert informing you to complete an account review.
You'll want to reach out to Mandrill support so they can look at your specific account. There's not enough information here about the API calls you're making or your account to be able to say what's happening.
It should be something related to your api if you are using api to send. Otherwise mandrill sends them right away as soon as you reach to next hour!
If you have just signed up for madrill then it usually takes longer time to prove your genuinity.
I suggest you to send a email with your details to help#mandrill.com and they will resolve it Max. 3 working days!
I did the same and they reverted within 30 hours and my mails are a breeze now!

How to get Maximum App requests per day

Most of Zynga games use the Maximum App requests per day to show to the user how many requests he can send that day. I couldn't figure out how to get that daily number (dynamically) . Any hints on that? Since, I'm doing this in a flash app. I can't let the user send requests more than he is allowed. Ideas?
You can find out your Requests limit via the Developer Settings page:
https://developers.facebook.com/apps
Note that limits only apply to the older method of sending requests. If you use the newer Requests functionality, there is no limit to the amount of requests you can send:
https://developers.facebook.com/docs/reference/dialogs/requests/
Naturally, if you're being spammy, you'll still get reported a lot and automated systems could block you, so remember to keep to a reasonable volume of requests.