Introducing Script Alerts for Webscript

Last week, we released a new feature for paid Webscript users: script alerts. Alerts make it easy to send an email or text message to yourself with a single line of code:

alert.sms('This is an SMS alert!')
alert.email('This is an email alert!')

We added this feature because we noticed that most of the time we were using email or text messages in our scripts, it was to send ourselves a notification. Alerts let you do that without having to sign up for a service that supports email or text messages. For an example of using alerts, see Todd's recent blog post about reminding himself to close the garage door.

Using the new alerts feature, I was able to simplify the website uptime monitoring example that we demonstrate in our intro video. (See the original code for comparison.)

local domain = request.query.domain

local response = http.request { url = 'http://'..domain }
local available = response and response.statuscode == 200

local changed = tostring(available) ~= storage[domain]
storage[domain] = available

if changed then
    alert.sms(string.format('The domain %s is %s.',
        domain, available and 'available' or 'offline'))
end

return { available = available, changed = changed }

Sending email and text messages costs real money, so we're only able to make alerts available for paid customers. If you're a paid user, you can change your email address or choose which phone number SMS alerts are sent to by visiting the settings page.