Python-powered chat apps with Twilio and SendGrid Transcripts
Chapter: Messaging and workflows with Twilio Studio
Lecture: Concept: calling an api in studio basic
0:00 we can go a really long way working just in twilio studio using the liquid template
0:06 language and so on. But eventually there will be external data that we need to
0:11 get things that we need to verify and integrations with our own applications that we would
0:15 like to make. The best way to do that is to call an external API
0:20 through twilio studio to remember when the person says they want a cake and
0:25 they go along a little ways eventually,
0:27 we need to say Well, here,
0:28 the types of cakes we offer,
0:30 the different frostings, the flavors,
0:32 the toppings and so on. Sure,
0:34 we could hard code that into our studio flow.
0:38 Then it would be hard coded.
0:39 What if we wanted to run a special?
0:41 Do you really want to go and have to edit this and change it?
0:44 No. You want to just have it automatically pick up whatever data you have available
0:48 and offer that up as part of the flow.
0:50 So what we can do is we can call an external API.
0:53 In this case, we're calling this Cloud City cake company.azurewebsites.net/api/flavours
0:56 to get us the flavor of frosting and so
1:00 on. So what we do is we drop make a Http request widget onto our
1:05 flow, give it a proper name.
1:07 In this case, we're just going to do a get against that.
1:10 URL so as a get and URL and then formula encoded content,
1:14 even though we're not actually passing additional information.
1:17 If we were, it would basically be query strings,
1:20 and that's it. That's all we gotta do to integrate.
1:23 Working with external data and external API's into our studio flow.