Python-powered chat apps with Twilio and SendGrid Transcripts
Chapter: Messaging and workflows with Twilio Studio
Lecture: Receiving and sending our first message
Login or purchase this course to watch this video and the rest of the course contents.
0:00 To get started. Let's just do a really simple message exchange. Somebody sends us a message. Let's just send them a really simple response.
0:09 We come down here, to the messaging, we want, just send message. We're not going to wait for an answer from them. The whole flow is going to be Hello.
0:17 Hi, there. So let's drag this over here and notice. We've got this little lollipop thing here and a whole that's the same size.
0:25 So we dragged these together. Now you can see when a message comes in, we're gonna run this. Let's go over and actually change.
0:33 The name should definitely set meaningful names here. You're gonna have to program against this name as if it was a variable or class
0:39 name or something like that throughout this whole workflow. But this one I'm gonna do TEMP_Echo Message or something like that.
0:46 Maybe normally I'd call it echo message, but I'm gonna call TEMP. There's also something wrong with it. And see the body
0:51 may not be null, so let's just so Hey there. Thanks for your cake interest. Great. And we save that it goes back to good.
1:01 Each workflow has its own URL as you'll see. So if we go over to the trigger and expand this out a little bit in
1:09 order to start this workflow in order to trigger the trigger, we could either do an API call here.
1:17 Or we could use this Web hook that we can plug into other parts of twilio or other Web apps. Basically,
1:22 this is a in point that if you do a post message to, it's going to start this workflow. So what we do is we're going to copy this,
1:31 and we need to tell our WhatsApp sandbox when it receives a message to start this workflow. You already saw that we have multiple workflows.
1:39 Which one is it going to start? Well, this one, over the programmable messaging we saw that there's the Try it out WhatsApp. We've already been here.
1:50 That's great. But what we need to do is go to the Settings section, WhatsApp sandbox settings, and we need to set the Web hook right here.
1:58 So when a message comes in right now, it's who knows is running some particular Web hook that is not our workflow. So we're going to change this,
2:06 come down here and press save. And now when a message comes in, it should run that workflow. We have one final thing to do. In order to make this work,
2:15 we go back to our Cloudcity, notice at the top. Here we have 10 changes. So as we work,
2:21 changes we make are saved, but they're not pushed to production. Remember, there could be live people interacting with this.
2:28 And you don't want to just push this out as you just mess around with it You want to get everything ready and say, now we're ready to publish it.
2:34 So let's press publish. Great. Our workflow is up to date. Let's see if we can send it a message it should respond with.
2:42 Hey there. Thanks for your cake interest. So back over here. Let's say I really need a cake. Awesome! Awesome. Awesome. Look at that.
2:53 It said, Hey there. Thanks for your cake interest. It's not nearly as involved in interesting as what you saw us do before,
2:59 but we're on our way down that path, aren't we were getting it set up. So we've sent a message over there to
3:05 twilio. It hit our sandbox which pushed over to that Web hook. That Web hook triggered the workflow. The workflow simply says, Hey,
3:13 if you start up, send the message back. Hey there. Thanks for your cake interest. Perfect. Everything set up and we're ready to build our workflow.