Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Twilio Best Practices
  • Toc
  • feedback
Twilio Best Practices

Twilio Best Practices

By : Rogers
4.5 (4)
close
Twilio Best Practices

Twilio Best Practices

4.5 (4)
By: Rogers

Overview of this book

If you have experience with at least one programming language and are looking to integrate Twilio into your applications, then this book is for you.
Table of Contents (10 chapters)
close
9
Index

Building a circuit breaker


Using Twilio's Usage Triggers, which we saw in Chapter 2, Exploring the REST API, allows us to build a circuit breaker.

In short, this will let us know when one of our subaccounts passes certain amounts of usage, which will help us detect possible abuse of our account, as well as mistakes in our code. It can even help detect abuse if we were running a multitenant app (that is, offering Twilio-based services to our users).

When our specified usage threshold is surpassed, Twilio will send a webhook to a URL of our choice. From this URL, we can perform a range of actions, whether that is sending ourselves an e-mail or even suspending the account in question.

For more details on Usage Triggers and how to specify them, head back to Chapter 2, Exploring the REST API. Here, we'll just run through a quick example of suspending an account if it spends more than $50 in one day.

We'll set up our Usage Trigger using the Twilio dashboard. To do this, first log in, and then switch...

bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete