Python-powered chat apps with Twilio and SendGrid Transcripts
Chapter: Sending outbound text messages
Lecture: The final notification: Your cake is ready
0:00 One more thing to do to our app.
0:02 One more chapter. So one more copy of our code here.
0:06 Go ahead and fire this up. It's obviously what we just finished with from Chapter 7
0:12 and here in our Cloud City Cake company.
0:14 Remember, we have our admin section,
0:16 and when it's finished what we tell the people to expect,
0:20 we told them to expect to get a message telling them that their cake was ready
0:24 that it was completed. Well,
0:27 if we push this button, it goes to the database and it marks it fulfilled
0:31 and refreshes this page like we learned did in our admin section.
0:36 But there is no text message to be found in our WhatsApp,
0:40 but that's what we're going to do in this chapter.
0:42 We're going to build out this button to actually send the notification back through WhatsApp.
0:47 to the user. And if we go look at the code,
0:50 the part that is relevant is the second part.
0:52 The fulfill part. And it says to do send a WhatsApp message to notify your
0:58 customers. So let's get this started by saying,
1:00 How did we send over here real quick?
1:03 How do we send email we used our email service.
1:05 How do we work with our users?
1:07 We use the user service. So we're going to have a WhatsApp service.
1:12 I'll say, send_order_ready or send_cake_ready.
1:16 How about that? And what we can pass along here is just the order that
1:20 we got. Neither of these exist,
1:22 So let's go make that happen.
1:29 We're gonna need to import this now that it exists.
1:31 And then let's write that function.
1:33 Thank you. PyCharm is going to be in order out of the database.
1:40 Perfect. So what we're going to need to do is do a little bit of
1:43 work with the WhatsApp, API here which turns out to be quite simple
1:47 to use, actually simpler than sending email.
1:49 To be honest, we use the twilio WhatsApp API,
1:52 to send this message over.
1:56 So really, all we have left to do to finish our entire application is to
2:00 write this one function. That's pretty awesome.