Welcome back.
So I've just found exactly the code that I need to send myself a text message.
Let's give that a go.
I'm going to copy and paste into my SMS file that I just created in my text me folder.
And.
All right, that looks like it's the code that I need.
Now, before I do this, it looks like this gives me a nice dashboard to test how my code before I actually
run it myself.
So I'm going to here in this to field actually put my phone number down.
Now I'm going to blur this out.
I don't want people text me because I'm already bad at answering texts as it is.
And the body over here will say, hey, or, you know, let's go.
Hello.
There we go.
And we see over here that it actually updates right over here.
So let's make the request and see what happens.
So I get a 400 bad request.
The two number is not a valid phone number and that's because I forgot the prefix.
Let's do a make request again.
All right.
And I get an error.
The number is unverified.
Tribal accounts cannot send messages to unverified numbers, so I have to verify my number that they
gave me.
That's kind of annoying, but.
All right, let's.
Let's do that.
All right.
So after a bit of searching, I saw over here that we can go to phone numbers and in the verified caller
IDs, I have to verify my number.
So I actually have to enter my real phone number so that they can verify it.
I guess this is so that people can just spam random phone numbers, which makes sense.
So let's see, where is Canada here?
And I'm going to hide my number again.
And I guess.
Or we can.
I don't want you to call me, so let's do text instead.
Oh, I have to enter it again.
All right, text me.
Yep.
I got a verification code.
Submit.
That's kind of cool.
I got a text on my phone.
All right, so I have my verified number.
Let's go back to where were we?
We were doing our project.
Get started.
All right.
And we have to do.
Hello.
And we'll use Python again.
Okay.
Let's make that request and see what happens.
Hey 201.
Created the request was successful.
And.
Holy moly, I'm.
I'm going to post this on the screen, but I just got a text from Twilio.
Says hello, not mind you.
It says that it's sent from a Twilio account.
So obviously when I have a fully paid non trial account, it wouldn't say this, but this is awesome.
I just received a text, all right?
So I didn't even have to open anything really.
I can just copy and paste this into.
My project file.
I just need to copy the token which in here they automatically include by.
I am assumed that I can get the token somehow from here.
Let's see how we can grab it.
Let's do settings.
I'll search off.
Token.
Two authorized apps.
Nope.
Not there.
Where could it be?
Let's go to user settings.
No, that's not it.
Oh, that's silly.
Look at that.
In the dashboard token, I can just click view.
Definitely going to hide that after this.
So now our token.
I can just paste it in here.
And I can change the body to whatever I want.
So I'll say, I can't believe this works.
Now the other thing is, is we have to download the Twilio Library.
So let's just say Pip three, install Twilio.
All right.
And this is now installed.
And let's run this file.
I'm going to say Python three SMS dot pi.
All right.
Looks like it may have worked.
Let's see.
Oh boy.
I am taking a screenshot of this.
That definitely worked.
I just received a text message.
How cool is that?
Now the reason I showed you this text tutorial is not because you really learn anything from it.
I just wanted to show you my thought process when I work through things that maybe I haven't encountered
before.
It's a lot of trial and error.
Knowing where to look.
For example, I knew that Twilio was a popular tool for text messaging.
But even Googling, you're most likely going to come across Twilio, and then it's all about reading
about their API and what you can do.
And most of them, like Twilio, if they're big enough, have really good documentation where you basically
don't even have to code.
Now, the beauty here is that in a couple of minutes, I was able to send myself a text message.
And now there's so many use cases that you can think of.
Again, we want to start thinking like programmers.
How can we use this?
Maybe when we receive an email from an important person, maybe when we get a specific tweet that we're
interested in, maybe we can receive a text using the Twilio API.
Maybe you have a portfolio website and you want to get a text.
Any time somebody completes your contact form or maybe orders your product from your startup landing
page.
The possibilities are endless, but with that, you've just learned how to send yourself a text message.
That was a lot of fun, but I think we deserve a break now, so I'll see you in the next video.