So let's create another alert, you know, but this time it will be a Web hook that sends a SMS so that
we get the message on our mobile phone, the same as Gateway.
I'm going to use it with SARS.
So you'll need niobium account.
If not, you can still watch the video.
And I'll show you a little bit about Web hooks because we'll create our own Web hook.
When I go to alerting notification channels, I can add a new channel here and here.
We have many types currently in this version of Ghafar.
There's no ability to call a local by script on your server.
So what I'll do instead is create a custom web hook and I'm going to call it SMS.
I'm not going to include images and it's going to be a local URL.
Like that we don't have any process listening on that port at that address yet, so what we'll do is
create a Python script that will listen for Webcke messages coming from Havana.
It will use the post method and then we'll add some more parameters to it as well.
But there seems no that will be sending, too.
And all of that information is in this page that you can copy from.
So the next thing to do is log in to Aiwass and go to your my security credentials page like that and
create a new user name for this example.
I'm going to name the user estimates send up.
I'm going to give it programmatic access.
No need to add it to a group and that group I'm going to call SML this group and I'm going to give it
the Amazon S.A.S. full access.
Policy fatigue that.
And then create group.
Press next next review and then great news on.
OK, so you get an access key and a secret, we need to copy those, so I'm just going to copy those
into a notepad.
Fallada OK, close.
OK, now go to services s a. simple notification service.
This is what we use to send the same message.
Now click this.
Start with an overview link.
We don't have to create a topic for this, so just click start with an overview.
So I'm using us e one region.
You can use any of these regions if you like, but not all regions have this text messaging.
Same link down here.
So I just say if you wanted to use Sydney or Singapore, you'd have text messaging SMS, but not if
you used Mumba.
So I use a region that has this link press that link text messaging and SMS.
I've sent a few semesters already there into the text messaging preferences.
By default, you will have an account spending limit of one USD a month or about Monda 10 to raise it
higher than one, you will need to apply to lift it.
So this link here and then you need to request a limit increase through the support center.
What they want to know is you're not going to use it to spam many people and you're going to use it
for a legitimate reporting process.
OK, default sender I.D. you can use anything you like.
I could use Carafano, but I'll show you how to set that when we sent the message.
Everything else is optional.
That's the most important thing about text messaging preferences is the you will need to up the limit
since SMS has cost money and you will quickly reach your one dollar a month.
Save China's.
So we can now send our sympathies using a script, so we now have to go into our Gravagna server.
OK, I'm a microfauna server.
This is a new Bunta icing server.
I need to install Python PIP because I'm going to create the Web hook process using Python to able to
install positive.
I already had Pip because I did this earlier, so we now need to install blast camera three.
Flask is a library for creating Ipis in Python, so we'll use it to listen to the incoming messages
and Boto three is a library for communicating with us.
Next, let's create a new session inside our site using the screen function.
And so this is similar to being logged onto your server with two users.
I can start a process in this screen session and then change back to the main SSA decision without closing
what I've just started.
So you might never have seen a screen before.
Let's create a new script called Pseudo and then send a semi stop.
Why?
OK, and in that script, copy this Python script, can we go now, this Python script?
OK, so use this flask, nieces, about three for the access key.
We need to put in the access key we just got from Aiwass.
So that's Mawn and the secret key that I just got from my Dubuis and the region.
US e one.
This is my region name here.
If you use Tokyo, for example, you you'd use ip ne one, but I'm using USD one and this is the end
point here.
Send SMS will also add a number to the query string and a message that will be extracted from the data
that Carfagna sends.
With that information, it will set the number, the message and the attributes.
Sender ID.
I'm going to click or fana.
You can use other names there and that's the sender of the ESM new mobile phone.
Now this doesn't work in all countries, but it works where I am.
And then after a run, if you know Python, this will make quite a lot of sense to you if you don't.
Doesn't matter.
I've written the script for you.
Control X to save.
Yes.
OK, Alice.
Now, because we're in a screen session, we can actually start this process and leave it running.
Python send a semester Peepli.
OK, so it's now serving a flask app called Send SMS, and it's listed on Haislip 127 zero zero one
five thousand to leave this screen session running press control I and then Control Day.
And then you'll be back into the minus S.H. session.
If you want to come back to your screen session, you can always write screen IFN ah it will take you
back press control idea again to exit.
OK sir.
Hij top just to show that that screen session is actually still running for.
I scroll down to the bottom, I can see what the bottom here.
Pathans in the Sims is still running in the background can control see except it's now time to go into
Caravana and finish setting up this web box.
Not that our little python server is listening on one twenty seven zero zero one 5000 ASMs.
The number I'm going to send it to is this is a one six four format telephone number.
So it's a country code plus the telephone number without the zero and leave off the plus side because
if you put that in your euro it's going to break.
So just the numbers we have to use post, we can save that.
OK, let's go back into it.
So now let's do a test site and test.
There we go.
I've just got an SMS.
OK, so he's my SMS, that's my screen mirror.
Someone is testing the alert notification professionals from Fana.
Let's test that again.
A mobile phone scientist.
And there we go.
And that's just a default message that Caravana is sending.
When I press Presentist, that is in the message parameter that you can see here, the Jason message.
So there's a send a message out there which we've created inside our little mini Pisin server.
It wants post, but it's going to read the number from the query string and that's the number there,
and extract the message from the post data.
And that's the sender Carafano.
That's the sender there.
So we could now use this alerting notification channel alongside our other notification channels.
So that's how to create a custom web hook and get an SMS through Fana.