Python-powered chat apps with Twilio and SendGrid Transcripts
Chapter: Using our database with the SQLAlchemy ORM
Lecture: Placing the order in WhatsApp

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Well, we're ready to test the entire flow,
0:02 including calling into our API and talking to the database and getting information back into WhatsApp
0:07 But it's very important to remember that if WhatsApp is going to find its way
0:12 back onto our computer, two things must be happening, First,
0:16 we must be running the app over here on localhost:5000 Just hit Run!
0:21 That's running. But also remember our friend in ngrok We haven't seen in ngrok for
0:26 a while, but it's back and we're going to run it again.
0:29 This is how studio flow is going to get through into our local machine.
0:34 Now remember, I use the sub domain option because I have a pro account.
0:38 If you didn't do that, you've got a new ID potentially here.
0:42 And when you get a new id,
0:43 and you've got to go back to studio and updat it and publish it.
0:45 So just be aware they give the
0:46 URL here Changes should be good to go.
0:49 Alright with those things in place,
0:52 kick me, over a small on the red velvet coming on.
0:57 We haven't ordered a lot of red velvet,
0:59 vanilla frosting and Sprinkles.,17 gold coins.
1:07 Sure, we got lots of gold coins
1:09 It's all good. Excellent. We just need your name.
1:12 I'll put Michael. I'm going to make sure that I use my same email address
1:16 I've already used, that way
1:20 When it comes back, it's going to find again that same user and associate.
1:24 Still, a new order with it should be making that call,
1:27 Now you order has been placed.
1:29 Oh my gosh, look at that.
1:30 It's under Michael, michael@talk python.fm,
1:32 and it's order number 4 that came out of the database.
1:35 Well, let's go check the database.
1:37 Exciting. You can see the call came in perfect.
1:42 Go to our database and get our orders.
1:43 What is order for a small red velvet Sprinkles,
1:50 Vanilla, 17 gold coins? user_id is 1 and that 4:51:43
1:59 4:51, 43. I'm going to say that's what The secondary.
2:03 You don't see it there, but exactly that time,
2:04 that's our order that came in and we go to the users again.
2:09 There's just the one user because it found that email address and pulled it back and
2:14 said, that user exists or is going to put the order on to their existing
2:18 account. So that's it. We've got our database entirely integrated into our API
2:22 which received the order from studio.
2:25 The studio flow saves it validates it, sends it back beautiful.