1
00:00:00,630 --> 00:00:07,170
So let's create another alert, you know, but this time it will be a Web hook that sends a SMS so that

2
00:00:07,170 --> 00:00:10,890
we get the message on our mobile phone, the same as Gateway.

3
00:00:10,890 --> 00:00:12,740
I'm going to use it with SARS.

4
00:00:12,750 --> 00:00:14,310
So you'll need niobium account.

5
00:00:14,520 --> 00:00:16,010
If not, you can still watch the video.

6
00:00:16,020 --> 00:00:20,610
And I'll show you a little bit about Web hooks because we'll create our own Web hook.

7
00:00:21,000 --> 00:00:26,340
When I go to alerting notification channels, I can add a new channel here and here.

8
00:00:26,340 --> 00:00:30,000
We have many types currently in this version of Ghafar.

9
00:00:30,000 --> 00:00:35,070
There's no ability to call a local by script on your server.

10
00:00:35,100 --> 00:00:40,020
So what I'll do instead is create a custom web hook and I'm going to call it SMS.

11
00:00:40,530 --> 00:00:44,550
I'm not going to include images and it's going to be a local URL.

12
00:00:46,960 --> 00:00:52,150
Like that we don't have any process listening on that port at that address yet, so what we'll do is

13
00:00:52,270 --> 00:00:57,190
create a Python script that will listen for Webcke messages coming from Havana.

14
00:00:57,400 --> 00:01:01,240
It will use the post method and then we'll add some more parameters to it as well.

15
00:01:01,780 --> 00:01:04,209
But there seems no that will be sending, too.

16
00:01:04,750 --> 00:01:09,290
And all of that information is in this page that you can copy from.

17
00:01:09,320 --> 00:01:16,420
So the next thing to do is log in to Aiwass and go to your my security credentials page like that and

18
00:01:16,510 --> 00:01:18,900
create a new user name for this example.

19
00:01:18,910 --> 00:01:22,340
I'm going to name the user estimates send up.

20
00:01:22,360 --> 00:01:24,430
I'm going to give it programmatic access.

21
00:01:26,170 --> 00:01:33,040
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

22
00:01:33,040 --> 00:01:36,550
the Amazon S.A.S. full access.

23
00:01:37,650 --> 00:01:39,600
Policy fatigue that.

24
00:01:40,660 --> 00:01:42,940
And then create group.

25
00:01:45,150 --> 00:01:49,290
Press next next review and then great news on.

26
00:01:51,430 --> 00:01:57,940
OK, so you get an access key and a secret, we need to copy those, so I'm just going to copy those

27
00:01:57,940 --> 00:01:58,900
into a notepad.

28
00:02:00,330 --> 00:02:02,870
Fallada OK, close.

29
00:02:02,900 --> 00:02:07,680
OK, now go to services s a. simple notification service.

30
00:02:08,490 --> 00:02:10,900
This is what we use to send the same message.

31
00:02:11,190 --> 00:02:12,060
Now click this.

32
00:02:12,060 --> 00:02:13,680
Start with an overview link.

33
00:02:14,050 --> 00:02:17,600
We don't have to create a topic for this, so just click start with an overview.

34
00:02:17,850 --> 00:02:21,300
So I'm using us e one region.

35
00:02:21,570 --> 00:02:26,310
You can use any of these regions if you like, but not all regions have this text messaging.

36
00:02:26,310 --> 00:02:27,570
Same link down here.

37
00:02:28,080 --> 00:02:34,920
So I just say if you wanted to use Sydney or Singapore, you'd have text messaging SMS, but not if

38
00:02:34,920 --> 00:02:35,730
you used Mumba.

39
00:02:36,090 --> 00:02:40,770
So I use a region that has this link press that link text messaging and SMS.

40
00:02:41,370 --> 00:02:45,270
I've sent a few semesters already there into the text messaging preferences.

41
00:02:46,210 --> 00:02:52,660
By default, you will have an account spending limit of one USD a month or about Monda 10 to raise it

42
00:02:52,780 --> 00:02:55,530
higher than one, you will need to apply to lift it.

43
00:02:55,540 --> 00:03:01,420
So this link here and then you need to request a limit increase through the support center.

44
00:03:01,600 --> 00:03:05,320
What they want to know is you're not going to use it to spam many people and you're going to use it

45
00:03:05,320 --> 00:03:07,340
for a legitimate reporting process.

46
00:03:07,940 --> 00:03:10,450
OK, default sender I.D. you can use anything you like.

47
00:03:10,750 --> 00:03:14,380
I could use Carafano, but I'll show you how to set that when we sent the message.

48
00:03:14,690 --> 00:03:15,880
Everything else is optional.

49
00:03:15,910 --> 00:03:21,340
That's the most important thing about text messaging preferences is the you will need to up the limit

50
00:03:21,340 --> 00:03:26,590
since SMS has cost money and you will quickly reach your one dollar a month.

51
00:03:26,950 --> 00:03:27,940
Save China's.

52
00:03:28,930 --> 00:03:34,760
So we can now send our sympathies using a script, so we now have to go into our Gravagna server.

53
00:03:35,180 --> 00:03:36,560
OK, I'm a microfauna server.

54
00:03:36,580 --> 00:03:38,860
This is a new Bunta icing server.

55
00:03:39,310 --> 00:03:44,700
I need to install Python PIP because I'm going to create the Web hook process using Python to able to

56
00:03:44,710 --> 00:03:45,590
install positive.

57
00:03:47,060 --> 00:03:51,710
I already had Pip because I did this earlier, so we now need to install blast camera three.

58
00:03:55,980 --> 00:04:03,360
Flask is a library for creating Ipis in Python, so we'll use it to listen to the incoming messages

59
00:04:03,360 --> 00:04:06,850
and Boto three is a library for communicating with us.

60
00:04:07,080 --> 00:04:12,030
Next, let's create a new session inside our site using the screen function.

61
00:04:14,390 --> 00:04:18,880
And so this is similar to being logged onto your server with two users.

62
00:04:19,220 --> 00:04:26,930
I can start a process in this screen session and then change back to the main SSA decision without closing

63
00:04:26,930 --> 00:04:27,890
what I've just started.

64
00:04:27,920 --> 00:04:30,520
So you might never have seen a screen before.

65
00:04:30,890 --> 00:04:35,580
Let's create a new script called Pseudo and then send a semi stop.

66
00:04:35,600 --> 00:04:35,990
Why?

67
00:04:37,400 --> 00:04:44,450
OK, and in that script, copy this Python script, can we go now, this Python script?

68
00:04:44,750 --> 00:04:48,460
OK, so use this flask, nieces, about three for the access key.

69
00:04:48,480 --> 00:04:52,700
We need to put in the access key we just got from Aiwass.

70
00:04:52,700 --> 00:04:59,480
So that's Mawn and the secret key that I just got from my Dubuis and the region.

71
00:04:59,780 --> 00:05:00,890
US e one.

72
00:05:01,340 --> 00:05:03,050
This is my region name here.

73
00:05:03,530 --> 00:05:11,310
If you use Tokyo, for example, you you'd use ip ne one, but I'm using USD one and this is the end

74
00:05:11,330 --> 00:05:11,840
point here.

75
00:05:11,850 --> 00:05:17,930
Send SMS will also add a number to the query string and a message that will be extracted from the data

76
00:05:18,110 --> 00:05:19,760
that Carfagna sends.

77
00:05:19,910 --> 00:05:24,470
With that information, it will set the number, the message and the attributes.

78
00:05:24,830 --> 00:05:25,790
Sender ID.

79
00:05:26,390 --> 00:05:27,650
I'm going to click or fana.

80
00:05:27,680 --> 00:05:33,710
You can use other names there and that's the sender of the ESM new mobile phone.

81
00:05:33,950 --> 00:05:37,160
Now this doesn't work in all countries, but it works where I am.

82
00:05:37,520 --> 00:05:45,320
And then after a run, if you know Python, this will make quite a lot of sense to you if you don't.

83
00:05:45,350 --> 00:05:45,890
Doesn't matter.

84
00:05:45,900 --> 00:05:47,000
I've written the script for you.

85
00:05:47,690 --> 00:05:50,050
Control X to save.

86
00:05:50,080 --> 00:05:50,570
Yes.

87
00:05:50,900 --> 00:05:51,920
OK, Alice.

88
00:05:52,310 --> 00:05:58,250
Now, because we're in a screen session, we can actually start this process and leave it running.

89
00:05:58,250 --> 00:06:01,880
Python send a semester Peepli.

90
00:06:03,340 --> 00:06:09,850
OK, so it's now serving a flask app called Send SMS, and it's listed on Haislip 127 zero zero one

91
00:06:09,850 --> 00:06:15,490
five thousand to leave this screen session running press control I and then Control Day.

92
00:06:15,760 --> 00:06:18,640
And then you'll be back into the minus S.H. session.

93
00:06:18,730 --> 00:06:25,390
If you want to come back to your screen session, you can always write screen IFN ah it will take you

94
00:06:25,390 --> 00:06:28,360
back press control idea again to exit.

95
00:06:28,670 --> 00:06:29,560
OK sir.

96
00:06:30,130 --> 00:06:35,140
Hij top just to show that that screen session is actually still running for.

97
00:06:35,180 --> 00:06:40,330
I scroll down to the bottom, I can see what the bottom here.

98
00:06:40,780 --> 00:06:47,830
Pathans in the Sims is still running in the background can control see except it's now time to go into

99
00:06:48,040 --> 00:06:51,310
Caravana and finish setting up this web box.

100
00:06:51,580 --> 00:06:57,840
Not that our little python server is listening on one twenty seven zero zero one 5000 ASMs.

101
00:06:58,750 --> 00:07:04,720
The number I'm going to send it to is this is a one six four format telephone number.

102
00:07:04,720 --> 00:07:11,020
So it's a country code plus the telephone number without the zero and leave off the plus side because

103
00:07:11,020 --> 00:07:13,610
if you put that in your euro it's going to break.

104
00:07:13,630 --> 00:07:18,160
So just the numbers we have to use post, we can save that.

105
00:07:19,270 --> 00:07:20,470
OK, let's go back into it.

106
00:07:20,920 --> 00:07:23,680
So now let's do a test site and test.

107
00:07:25,810 --> 00:07:26,390
There we go.

108
00:07:26,410 --> 00:07:28,060
I've just got an SMS.

109
00:07:28,550 --> 00:07:33,410
OK, so he's my SMS, that's my screen mirror.

110
00:07:33,550 --> 00:07:37,210
Someone is testing the alert notification professionals from Fana.

111
00:07:37,490 --> 00:07:38,500
Let's test that again.

112
00:07:39,590 --> 00:07:41,690
A mobile phone scientist.

113
00:07:42,860 --> 00:07:43,530
And there we go.

114
00:07:43,910 --> 00:07:47,210
And that's just a default message that Caravana is sending.

115
00:07:48,250 --> 00:07:56,860
When I press Presentist, that is in the message parameter that you can see here, the Jason message.

116
00:07:57,160 --> 00:08:02,670
So there's a send a message out there which we've created inside our little mini Pisin server.

117
00:08:02,680 --> 00:08:07,570
It wants post, but it's going to read the number from the query string and that's the number there,

118
00:08:08,230 --> 00:08:10,980
and extract the message from the post data.

119
00:08:11,200 --> 00:08:13,540
And that's the sender Carafano.

120
00:08:13,810 --> 00:08:14,800
That's the sender there.

121
00:08:15,670 --> 00:08:22,690
So we could now use this alerting notification channel alongside our other notification channels.

122
00:08:22,930 --> 00:08:28,270
So that's how to create a custom web hook and get an SMS through Fana.

