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