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