#100DaysOfWeb in Python Transcripts
Chapter: Day 51: Twilio
Lecture: What did we learn?
0:00 And that was the super simple Twilio API.
0:03 You've probably watched all of these in one day.
0:05 Let's breeze through this.
0:07 Sending an SMS with Twilio.
0:10 What we did was, we imported the client function
0:13 from Twilio.rest.
0:15 We then specified our account
0:17 SID's and authentication tokens.
0:20 Now these could be specified in an OS variable
0:24 or an OS environment variable
0:26 but you can probably just hard code
0:28 if no one's going to look at this
0:30 just for this simple exercise.
0:32 Next, we used our client function
0:36 to take the account SID and the authentication token
0:40 and create ourselves a little client object
0:42 and we use that object to create ourselves a message.
0:46 And finally within that message we had our two phone number
0:50 which we had to make our own mobile
0:52 because that was the number that was verified
0:55 with Twilio and then we had the phone number and our body.
1:01 Now, moving onto this unverified phone number error.
1:05 So if you tried to send a text message
1:08 to a number that you did not verify yourself
1:11 you would receive this message
1:13 on the command line as an error.
1:16 So, unable to create record. The number is unverified.
1:19 Trial accounts cannot send messages to unverified numbers.
1:23 This is something I've mentioned before
1:25 so what you would need to do is actually get
1:28 that number verified.
1:29 And that would mean letting that person know
1:31 and getting it on that page and you go from there.
1:36 That is it. Your turn.
1:39 Try and put something interesting in the body.
1:41 Try to automate that.
1:42 So again, see if you can, if you're pulling data
1:45 from web scraping or something like that
1:47 and pop that into the body text field of our SMS and see
1:52 if you can text yourself something interesting.
1:55 Again, keep calm and code in Python.