Automatic Notification of Quota and Billing Issues

Keeping your customers happy is paramount. And nothing alienates them more than stopping their service after they’ve made an innocent mistake. This playbook walks you through the steps required to keep your customers in the loop when quota or billing issues arise.

Use Cases

We’ve all had an invoice that inadvertently went unpaid, or an implementation that inexplicably starts to go rogue. Instead of coming down hard and blocking your customer’s service, why not cut them some slack and send them a warning if they approach their API rate limit, or payment due date.

With Moesif’s behavioral email solution it’s a simple process to automatically keep your customers in the loop; Give them the chance to modify their implementation or change their subscription plan, whilst ensuring your API performance SLAs don’t fail.

What are the scenarios where you should notify your customers of subscription or rate limit issues?

Going over quota can occur from the following events:

  • Faulty customer implementation
  • Sudden increase in traffic from a single customer that, at the limit, could lead to a service outage for all users
  • DDoS attack on your APIs, which tank your servers
  • Unexpected spike in traffic when your service’s popularity snowballs

Similarly, your subscription might not be renewed if:

  • There’s a change in billing credit card
  • The contact person within the finance department is switched
  • USPS lost the check

Better Customer Relations with Moesif

Customer Success Management can improve client relations by giving customers a heads-up that their APIs are approaching their plans’ rate limit. Customers then have the opportunity to right-size their plans, or modify the API’s parameters, before 429 Too Many Requests error responses are sent.

Most API Gateways like Kong and NGINX will add rate limiting plugin HTTP response headers on every API call, so that rate limits can be observed and set by developers. With the combination of API analytics and behavioral emails from Moesif, sophisticated capabilities to scale customer communication are surfaced through a simple UI.

The complete capabilities of Moesif’s integration with the Kong Gateway is thoroughly explained in a companion article.

Learn More About Moesif Automate Customer Outreach With Moesif 14 day free trial. No credit card required. Learn More

Playbook for Automatic Notification of Quota and Billing Issues

Automating repetitive processes is a key attribute in whole-product design. By combining payload observability with behavioral emails, Moesif’s able to make you more productive through sophisticated workflows of many functional, performance and product issues.

This demonstration playbook focuses on performance and subscription issues your customers may encounter, specifically illustrating Moesif’s capabilities by showing you how to deal with users who approach their rate limit or those that might have their account suspended due to overdue invoices.

Other playbooks focus on How to Secure Your API Against Attacks and Intentional Misuse and How to Guide Customers on API Integration Automatically with Moesif. The three playbooks only really scratch the surface of what’s possible with our platform; Once you get the hang of creating your own cohorts, specifying triggering events and designing behavioral emails, you’ll wonder what you ever did before Moesif.

List of Ingredients

We’ll be using Moesif’s analytics tool to build this app. If you haven’t yet created an account you can sign up for free.

Learn More About Moesif Build Better API Products With Moesif 14 day free trial. No credit card required. Learn More

Steps in Playbook Creation

Playbooks include workflows, SOPs, and cultural values, that go together to shape a consistent response — the play. Irrespective of what you’re trying to achieve, Moesif playbooks contain two key elements: cohort specification and email creation.

Cohort Specification

Moesif defines user and company as distinct entities, ones which can be grouped into cohorts sharing similar criteria. Distinct cohorts include those sharing similar fields, such as: subscription plans, endpoint usage, request codes, etc. Cohorts can be created by filtering on user/company demographics and actions, as explained in an earlier tutorial.

To create a new user cohort go to the Users > User Lookup section of the Moesif tool and simply choose fields from the pulldown menus Users that match and Performed events. The full list of event filters and user/company fields can be found in our user-analytics pane.

Warning when approaching a rate limit

To create a cohort of users that are approaching their rate limit, go to the Users > User Lookup section:

  • From Performed events set the filters:
    • response.headers.Ratelimit-Remaining < 100
    • The time period is At Least 1 times in Last 24 hours And we’re also going to skip users who are on the enterprise plan as they will get a more personalized follow up:
  • From Users that match set the filter:
    • metadata.plan is not enterprise(1) This is shown in the screen capture below:
Rate limiting cohort

Account overdue

To create a cohort of those who have let their subscriptions lapse, go to the Users > User Lookup and select from Users that match the filters: metadata.outstanding_invoices > 1, &, metadata.due_since is before 1 Month Ago, as shown below.

Account overdue cohort

Once filters are set, Moesif will look through current and historical data and group together all of the users/companies that fulfill the filters’ criteria. We’ll also monitor whether the users/companies continue to belong to that cohort, without any manual intervention.

The cohort can then be used to populate the recipient list in a behavioral email.

Email creation

You can design HTML emails right in Moesif using a drag-and-drop WYSIWYG editor. To create a behavioral email go to the Alerting and Governance > Behavioral Emails section of the Moesif tool.

The first step is to add a new +Template, where the template includes both the email design as well as other pertinent info, such as which cohorts should receive the email. Full documentation on creating email templates is available, but suffice it to say, email creation is pretty straightforward and, once complete, emails can be verified using the Test button.

Warning when approaching a rate limit

Simply add the pre-defined cohort to the recipient’s list of the behavioral email warning of approaching the rate limit. To avoid spamming customers continuously, set the re-enrollment criteria for 24 hours:

Behavioral email informing of approaching rate limit

Now, whenever customers approach their rate limit they’ll automatically be added to the cohort, and a warning email sent.

Account overdue

Similarly, simply add cohort of customers you’ve previously defined to a behavioral email that warns them that their subscription is overdue:

Account overdue email

Whenever a subscription is overdue, the lapsed user will automatically be added to the cohort, and a warning email sent.


With our SaaS platform, we strive to make our customers as productive as possible. Through the combination of payload observability and behavioral emails, we’ve created automated warning processes for integration issues, saving you time and resources.

Learn More About Moesif Save Time And Resources With Behavioral Emails Workflows 14 day free trial. No credit card required. Learn More
Notify Customers Of Quota And Billing Issues Notify Customers Of Quota And Billing Issues

Notify Customers Of Quota And Billing Issues

Learn More