Python-powered chat apps with Twilio and SendGrid Transcripts
Chapter: Creating the Flask Python web app
Lecture: Posting the order to the API via Studio

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's jump back over to Twilio Studio.
0:02 Now here's our workflow that we've been working on throughout the course.
0:07 If we go all the way down to the bottom here,
0:11 remember, we got their email address,
0:13 we got their name and we are already gathered up all the details about their order
0:17 And we said, Super,
0:19 your order has been placed. Not really.
0:21 Why not? Really? Because we didn't have our Endpoint that we just finished
0:25 billing available to send. So let's go and add that here are not using voice
0:31 I'm going to do and make an http request here.
0:36 I'll call this order API.
0:38 And as we saw, the method is going to be post now the domain.
0:42 I'll put something in here. Do you think that's gonna work?
0:46 No we have to come back and figure out something for that.
0:51 Let's say we're going to add some JSON and let's expand this so we get some
0:54 room. What we're gonna do is we're going to construct a JSON document that's going
0:59 to have customer data and the details of the cake order data.
1:04 Consider you watching me. Type that out.
1:05 Let me paste something here like so and then we can have a look at it
1:09 Our overall document is going to be that there's going to be a customer with
1:13 a number, name and email,
1:16 and there's going to be a cake,
1:17 which is all the stuff that they filled out and then also the price that we've
1:22 quoted them. So the number all of this stuff here is going to be filled
1:26 out with liquid. Let's do this one first.
1:30 So we'll come over here and we'll say widgets.
1:32 GetName. I believe we called it inbound.Body
1:37 body email is going to be the same.
1:44 GetEmail.inbound.Body now number is interesting.
1:50 We didn't ask them their number.
1:51 They sent us their number when they connected,
1:53 right, That's way up at the top here, on the trigger.
2:00 So what we can do for the number is we can say trigger.message.From, So
2:07 we got their number. We got the name that they've answered,
2:10 entered. We've got the email that they've entered,
2:12 and we're just going to do the same thing for topping, frosting,
2:15 flavor, size and price. So when I go through all of the various widgets
2:20 as cake topping, as cake frosting, as cake flavor.
2:24 Get the inbound body. That's the various answers they gave.
2:27 And then we're gonna go to the size one,
2:30 which was the welcome. Their response to the welcome over here when we asked them
2:35 what size do they want?
2:37 And the last one slightly slightly different here, because this comes from our other API call
2:43 Remember, we confirm the price here where we priced the cake with an http
2:47 Get request. We got back and see regular
2:53 So that's what goes right here.
3:01 Perfect. So that's the price in gold coins that we're gonna have.
3:05 So everything is ready around our body.
3:08 Let's have made a mistake, which we'll find out soon enough and will fix, of
3:13 the top. We still need some way to call this,
3:15 so it's not exactly going to work,
3:17 But we've got everything set. As soon as we find a place to send that request to.