Text me baby.....

This week I've been looking into the possibility of getting our monitoring system(s) to be able to send SMS alerts in the event of really critical problems - to try and prevent business outages or at least get us alerted ahead of the game before the business calls us out to tell us something isn't working.

In the olden days (pre 2018...... - seriously pace of change in IT at the moment is crazy) out mobile provides used to have a service that would let us email to a certain formatted email address (something like mobilenumber@mobileprovider.com) and this would magically turn the email into a text message and send it out - this has long since disappeared so we have to replace it with something else.

As we are in Azure in this case we can't install any kind of hardware solution to enable this, so that's out and we have to look at software solutions. Our current mobile/comms provider is just too difficult to try and progress anything with so we were looking at other solutions on the market.

The one we looked into (which is mentioned quite a few times in the Azure docs) is Twilio  (https://www.twilio.com/) . This isn't Azure specific and can be used a s a solution from any machine that can talk to the internet.

In fact the whole offering from twilio looks very good and can do a huge amount of stuff that may be interesting (I'm not on commission here :-)) - for now we just want to prove that we can send an SMS from a linux machine.

So here's what i did to set that up.

1) sign up for free trial (which currently gives you $15 credit) - no credit card or any commitment needed
2) create a 'twilio' phone number - this is just one click in the twilio console and its completely obvious so no need to discuss further.
3) Find your account sid and auth token (avalable on the home page of the console app) - see pic below

4) write a curl command to call the REST API that sends a message - this is a simple as the following:

curl -X POST -F "Body=Hi there, your new phone number is working." \
    -F "From=+twilionumberhere" -F "To=+destinationmobilenumber" \
    "https://api.twilio.com/2010-04-01/Accounts/accountidhere/Messages" \
    -u "accountidhere:authtoken"

run that code and a few seconds later i get an SMS - as easy as that - an this took me no less that 10 mins from having no twilio account to sending the message - very impressive.

Twilio supports the mobile numbers we need - UK/Germany/India so no problems there - we now just need to check it integrates with our tooling fine (can't see why it wouldn't) then i think we have a neat solution.

There seems to be direct integration too for many programming languages here also so you could build it directly into apps and it also supports actual phone calls which could also be useful in certain on call cases.

All in all impessive service offering.....


Post a Comment