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, including calling into our API and talking to the database and getting information back into WhatsApp
0:08 But it's very important to remember that if WhatsApp is going to find its way back onto our computer, two things must be happening, First,
0:17 we must be running the app over here on localhost:5000 Just hit Run! That's running. But also remember our friend in ngrok We haven't seen in ngrok for
0:27 a while, but it's back and we're going to run it again. This is how studio flow is going to get through into our local machine.
0:35 Now remember, I use the sub domain option because I have a pro account. If you didn't do that, you've got a new ID potentially here.
0:43 And when you get a new id, and you've got to go back to studio and updat it and publish it. So just be aware they give the
0:47 URL here Changes should be good to go. Alright with those things in place, kick me, over a small on the red velvet coming on.
0:58 We haven't ordered a lot of red velvet, vanilla frosting and Sprinkles.,17 gold coins. Sure, we got lots of gold coins
1:10 It's all good. Excellent. We just need your name. I'll put Michael. I'm going to make sure that I use my same email address I've already used, that way
1:21 When it comes back, it's going to find again that same user and associate. Still, a new order with it should be making that call,
1:28 Now you order has been placed. Oh my gosh, look at that. It's under Michael, michael@talk Python.fm,
1:33 and it's order number 4 that came out of the database. Well, let's go check the database. Exciting. You can see the call came in perfect.
1:43 Go to our database and get our orders. What is order for a small red velvet Sprinkles, Vanilla, 17 gold coins? user_id is 1 and that 4:51:43
2:00 4:51, 43. I'm going to say that's what The secondary. You don't see it there, but exactly that time,
2:05 that's our order that came in and we go to the users again. There's just the one user because it found that email address and pulled it back and
2:15 said, that user exists or is going to put the order on to their existing account. So that's it. We've got our database entirely integrated into our API
2:23 which received the order from studio. The studio flow saves it validates it, sends it back beautiful.