We are using a public Site to receive webhooks from a number of different system. Some of which are payments systems, one of which is for mass email.
On the email system, it's useful to receive notifications when the recipient has opened their email. However, this creates lots of API calls. The email system notifies you on every open, and cannot batch those notifications. So, if you send an email to 25k people, and they all decide to open it 4 times, that's 100k API calls. This causes our org to blow its API limit and then it can no longer receive updates about payments.
I'm considering various options (clearly we could switch off the notification for opens, but it is useful). In an ideal world, we would be able to give the email system a quota of API calls and reserve the rest for critical functionality.
I see there was a pilot for enforcing quotas on Connected Apps in Spring 14. That was obviously some time ago, and it's only a pilot, and we're not using a Connected App here so maybe it's just a dead end.
Is some sort of quota possible? Can we enforce an API limit quota onto a particular user, or Site?
I have an ugly idea... I could put the email system onto its own Site, then have a scheduled job running to check the API limit by using the Limits endpoint on the REST API (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_limits.htm). If I'm getting close to the limit, I could deactivate the guest user for the Site handling email notifications. Then re-enable it when there are more API calls available.
That idea seems like quite a lot of work... Any better ideas?