Python-powered chat apps with Twilio and SendGrid Transcripts
Chapter: Messaging and workflows with Twilio Studio
Lecture: App walkthrough

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now, before we dive in to start working with Twilio studio and building our messaging
0:04 workflow, let's take a pass as a user through the entire experience.
0:09 So you get a sense of what we're going to build.
0:12 It's gonna take us a while to get there,
0:14 but you'll see where we're going by having seen this.
0:17 Okay, we're going to build a Flask based Python Web application.
0:22 We're also going to build a chat interaction where people can use WhatsApp to order a
0:27 cake at the Cloud City Cake company.
0:29 So they could either just remember our number,
0:32 find it somewhere and click it on WhatsApp.
0:33 Or they could actually just click this link right here,
0:35 which will open WhatsApp and start the conversation over here,
0:39 It loads up our sandbox test number because we haven't pushed this to production yet.
0:43 So it's a twilio number, not the primary one.
0:46 We'll do that when we finish this.
0:48 If we were going to actually put it in production,
0:50 we'd have our own business account here.
0:52 So we'll say something like, Hi,
0:54 I need cake. That's great.
0:55 Welcome to the Cloud City Cake Company and it knows what type of cakes that it
0:59 can work with. So in the Twilio studio,
1:02 it knows, if I get a message,
1:04 the first thing I want to say to them is,
1:06 Welcome. What size of cake?
1:07 Well, we'll say small because we don't want to go overboard here.
1:11 We're going to order a lot of cake during this,
1:12 Of course. Now the twilio studio went out to our website actually,
1:18 and got the available cakes from our menu and said,
1:21 These are the cakes were currently offering?
1:23 What kind of flavor would you want?
1:24 Well, let's say we want to carrot cake, with some lemon frosting.
1:31 Maybe Sprinkle it with bacon. A little outrageous there.
1:35 Now it goes to another API that says,
1:37 given a small carrot cake with lemon frosting and making toppings,
1:42 How much is that going to cost?
1:43 And it offers that says, Do you really want to do this Yes or no
1:46 So sure we'll do that.
1:47 We could say y or yes or whatever.
1:49 Now it's going to collect our personal information so that it can store that in the
1:53 order information over in our Flask Web application that you just saw.
1:59 So, I'll enter some info here.
2:01 My name, my email. Fantastic.
2:08 So, when I enter that information,
2:09 what happened? Is twilio studio actually called over to our Flask application our Flask application
2:16 said, Can we process this order?
2:17 Yes, we can. It sent us an email through Send Grid,
2:20 and it actually generated a order invoice as a PdF and attached it to that.
2:26 So let's go check our email and look what we have in our email over at
2:30 michael@talkpython.fm.
2:32 That's what I said. My email was We got a cloud City cakes receipt and
2:36 a nice template here. It says our order is being processed.
2:39 It summarizes exactly what we ordered.
2:41 A small carrot cake, bacon with lemon frosting and bacon topping.
2:46 It costs 19 gold coins. Fantastic says thank you.
2:50 It has a little extra information at the end,
2:51 and it has this invoice. Do we have a proper PDF invoice that says,
2:57 you know you were placed an order with Cloud City Cake company at 123 Main Street
3:02 Tech Town USA. Here's our invoice number.
3:05 The number of gold coins we paid in a little bit of summary information about what
3:09 we've ordered. Check that out, So this is what we got working with our WhatsApp
3:15 messages over here. We talked to the twilio studio.
3:18 It's sent that back through an API to our Flask application, our Flask application
3:24 generated this email and this invoice and send it our way, over in the admin section
3:30 Let's see if we have a new order.
3:31 We do, here we have an open order.
3:34 You can see that some have been fulfilled,
3:36 but there's one that's open. So let's do all the work.
3:40 Bake the cake put in the oven and it's time to let our user Michael Kennedy
3:44 here know that their order is finished and they should come pick it up.
3:48 They started this conversation on WhatsApp,
3:50 so we're going to send an outbound message to WhatsApp to their account.
3:54 So we press fulfill and if we watch up here in the top right in just
3:58 a moment, we should see a notification your cakes order status is ready for pickup
4:03 and there it is. We've gone to the website or otherwise figured out a number
4:08 to place the order. We sent a text message through WhatsApp.
4:12 We had this whole exchange, some of it worked managed by Twilio studio and some
4:17 of it actually interacting with different parts of our application or API.
4:21 We have placed an order. We got a receipt.
4:23 Eventually, our bakers notice that they bake the cake and let us know through WhatsApp
4:28 that the order is ready for pickup.
4:31 This is a fantastic application and we're going to build that out throughout this entire course
4:35 it's gonna to be so much fun to build,
4:38 and I think you're going to learn a lot.