Python-powered chat apps with Twilio and SendGrid Transcripts
Chapter: Messaging and workflows with Twilio Studio
Lecture: Confirm the price of the cake
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We don't know the price. And we've told them what is going to cost.
0:03
But what we really need to do is ask.
0:05
Here's how much it's gonna cost.
0:06
Are you ready to pay for that?
0:08
But let me just nab this.
0:10
Copy this message body. So I'm to type it again and get rid of that
0:14
and want to come over here instead of doing a send.
0:16
We're gonna do like we have been a send and wait for replies also be confirmed
0:21
price. And the message is going to be this.
0:24
Do you want you place that order, over here?
0:32
If they say no, we're gonna need to do a test first.
0:36
So let's get our split. We're going to test if they said yes,
0:44
basically, in some way or another.
0:47
If not, then we're going to send him a message like Sorry,
0:49
I guess you're not looking for any cake.
0:57
But if they do confirm yes,
0:59
they want it, then we're going to send a message like,
1:02
and that's just gonna be a little placeholder while we're working on this.
1:05
So let's say CheckConfirm And what is our variable?
1:11
It's going to be ConfirmedPrice.inbound.body
1:16
And if no,
1:21
there's no match, We're gonna say sorry.
1:23
I guess you don't want cake.
1:24
But if there is, and I have to determine if there's a match, So what
1:29
could they type? They might type.
1:30
Yes, but they might just have y type?
1:34
y they might type. Yeah,
1:36
they might type, please. They might type.
1:39
Definitely. You can just go through the various things you would be willing to accept
1:44
here, right? We could also loop around and make them say yes or no
1:48
But I'm just going to keep it.
1:50
Keep it simple like this. But if it matches this one,
1:55
we're gonna go along here and say,
1:57
Great. Um, we'll need some info from you to keep going.
2:02
This one will just say no cake.
2:13
Sorry. You're not having cake with us today.
2:14
Something along those lines. All right,
2:17
publish it. I think we are about ready.
2:20
So when I come through and make sure that they say yes.
2:22
Yeah, Y, please.
2:25
Definitely something like that. Which case?
2:28
Down the path they go. Please tell me your name,
2:30
your email and so on. More cake.
2:35
Feel in rainbow again. How about you guys,
2:37
but small. You have to do this a lot of times.
2:40
Rainbow don't need to test our error handling.
2:43
Won't try to not try to not trigger it.
2:46
All right, let's have Sprinkles on our rainbow maple cake or pricing it at the
2:53
API should have an answer and get a response back.
3:00
Oh no, our order stopped.
3:02
Actually, there's a really small mistake.
3:04
Let's go fix it when we price our cake.
3:06
We forgot to make that little connection right there.
3:09
So when it got to this part,
3:10
it priced it and then exited.
3:12
Let's try one more time and we're back.
3:18
Let's get a small, rainbow chocolate Oh,
3:23
chocolate. Hey! And I think I'll go for Sprinkles again.
3:29
Those sound fun. Perfect. That will cost us 18.5 gold coins.
3:35
Would you like to place that order?
3:36
Remember, we could type Y,we could type.
3:38
Yeah, we could type. Definitely.
3:41
We don't We type something wrong or something that is not confirmation is going to say
3:46
sorry, you're not having cake with us,
3:48
but let's go ahead and with try.
3:49
Yeah, great. We'll need some info.
3:53
That's actually the end of the workflow,
3:55
but this is where we can go and ask questions like All right,
3:57
tell me your email address. Tell me your name and so on.
4:01
Cool. So it looks like we've got our pricing and our price confirmation integrated.