Server Notifications

Never miss another server outage. Learn how to build a server notification system that will alert all administrators via SMS when a server outage occurs.

Start Tutorial

What does this thing do?

This ASP.NET sample application demonstrates how to send SMS alerts to a list of system administrators if something goes wrong on your server. In this tutorial, we'll show you the key bits of code to make this work.

See how EMC uses Twilio SMS to send IT alerts to 68,000 employees.

Let's get started!

See Also:

List server admins

Create a list of administrators who should be notified if a server error occurs. The only requirement we have is a PhoneNumber.

See Also:

Configure Twilio client

In order to send a message we'll need to initialize the Twilio C# Helper Library, which requires reading our TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN defined at ServerNotifications.Web/Web.config

See Also:

Handle all application errors

In an ASP.NET MVC application, we can handle errors at the application level. Note that any other exceptions caught in the code (using your own try/catch blocks) are not being captured and processed here.

See Also:

Create a custom alert message

Here we create an alert message to send out via text message. You might also decide to include a picture with your alert message, maybe a screenshot of the application when the crash happened?

See Also:

Reading the admins from the CSV file

Next we read the admins from our CSV file. We use the method GetRecords to read all the records.

See Also:

Sending a text message

There are the three parameters needed to send an SMS using the Twilio REST API: From, To, and Body. US and Canadian phone numbers can also send an image with the message.

See Also:

Where to next?

That's it! We've just implemented an automated server notification system that can send you server alerts if anything goes wrong. If you're a C# developer working with Twilio, you might want to check out these other tutorials.

Two-Factor Authentication

Increase the security of your login system by verifying a user's mobile phone in addition to their password.

Appointment Reminders

Send your customers a text message when they have an upcoming appointment, this tutorial shows you how to do it from a background job.

Did this help?

Thanks for checking out this tutorial! If you have any feedback to share with us, we'd love to hear it. Tweet @twilio to let us know what you think.