Saturday, October 29, 2022
HomeWordPress DevelopmentDo you want scary motion pictures? Construct a Halloween Challenge with Twilio

Do you want scary motion pictures? Construct a Halloween Challenge with Twilio


Halloween is true across the nook, which suggests it is time to put together a dressing up, replenish on treats, create enjoyable DIY tasks with Twilio, and consider methods to scare family and friends.

On this weblog submit, I’ll train you tips on how to construct a spooky Halloween IVR (Interactive Voice Response) undertaking utilizing Twilio Studio, our low-code/no-code utility builder with drag and drop widgets.

Image description

After you’ve constructed this program, you should use it to scare your folks & household. I’m positive you’ll get some reactions like this:

Image description

Wish to strive it out your self? Ensure your telephone isn’t set to Do Not Disturb, then ship a textual content message to +1(940) 394-8137. However beware, it’s creepy.

This weblog submit is structured as follows:

  1. Stipulations: Belongings you want earlier than persevering with
  2. Twilio Studio Circulation: Create a Circulation, then construct our undertaking with drag and drop widgets
  3. Twilio Belongings: Add static recordsdata for our Studio Circulation
  4. Twilio Studio Widgets: Proceed constructing our undertaking with Studio Widgets



Stipulations

Earlier than getting began, it’s essential to have the next earlier than shifting on:



Twilio Studio Circulation

Twilio Studio is a visible device you should use to construct communication tasks with little or no code. Inside Studio, we’ll create a Circulation, which represents workflows that you simply construct.

To create a brand new Circulation:

  1. Log into your Twilio account within the Twilio Console.
  2. Navigate to the Studio Flows part within the Console.
  3. Click on Create new Circulation or the + icon beneath the Flows heading to create a brand new Circulation.
  4. Title your Circulation. For this undertaking, let’s identify it Do you want scary motion pictures? Then, click on Subsequent.
  5. Choose the Begin from scratch choice. Then click on Subsequent.

Now we will begin constructing our undertaking by dragging and dropping Widgets onto the Canvas.

We wish our undertaking to make a telephone name to the person after they ship a textual content message to our Twilio telephone quantity. To construct this, drag and drop the Make Outgoing Name Widget onto the Canvas. Then, from the Set off Widget, draw the Transition from Incoming Message to the Make Outgoing Name Widget.

Image description

At this stage, if we Publish the Circulation to check our adjustments, issues wouldn’t work instantly. We’d must configure a Twilio telephone quantity to hook up with this Studio Circulation.

Navigate to the Lively Numbers part of the Twilio Console and click on in your Twilio quantity. Scroll right down to the Messaging part and configure your quantity to when A Message Comes In, by choosing the dropdown choice “Studio Circulation”. You may see one other dropdown menu seem the place you’ll be able to choose the Studio Circulation you need to hook up with when a message is available in to this quantity, on this case Do you want scary motion pictures?

Image description

When texting the Twilio telephone quantity you simply configured, it ought to now make an outgoing name to the identical telephone quantity.

From right here, we’d like for our program to take heed to the caller and work together with them. To start out, inside our Circulation we will drag and drop one other Widget onto the Canvas. Let’s use the Collect Enter on Name Widget and have it join from the Answered choice from our Make Outgoing Name Widget.

Image description

The Collect Enter On Name Widget (which we simply used) permits you to collect a person’s enter whereas they’re on a name. This knowledge can then be shared to a different Widget for different operations.

We anticipate some caller enter, now we wish our name to say “hi there”. We’ll use one other Widget referred to as Say/Play and drag and drop that onto the Canvas. With that Widget chosen, rename it to “hi there” within the Widget Inspector Panel. For our Transition, we’ll join all three choices from our Collect Enter On Name Widget to our “hi there” Say/Play.

Image description

Say/Play can say textual content messages with text-to-speech or play recorded messages from a URL of an audio file. For this undertaking we wish the latter. Let’s use Twilio Belongings to add a media file and have it deployed to a URL.



Twilio Belongings

Twilio Belongings permits you to add static recordsdata to make use of with Twilio tasks. For our use case, we’ll add a media file and Belongings will serve that file over HTTPS. Earlier than we use Belongings, we’ll must create a Twilio Service, a container for Features.

Create a brand new Service:

  1. Navigate to the Companies part within the Console.
  2. Click on Create Service.
  3. Title your Service. For this undertaking, let’s identify it do-you-like-scary-movies. Then, click on Subsequent.

Assuming you have already got an audio file in your laptop that claims “hi there” in a creepy voice, you’ll be able to add your file. If you happen to don’t, I like to recommend looking the interwebs for the same file or utilizing your personal voice recording.

Click on the Add+ button and choose Add File from the dropdown menu. Browse your file system and find your audio file. Change the visibility to Public. Then, click on Add to start importing your file.

Image description

Whereas the Asset has been uploaded, it won’t be instantly accessible through a URL. This might be indicated by the grey circle subsequent to the Asset’s identify. To deploy the Asset (and the remainder of your Service), click on the Deploy All button. After a short interval, the deployment will end, and you need to see a inexperienced verify seem subsequent to all deployed Belongings.

Click on on the three dots subsequent to your Asset, which opens up a context menu. Then click on Copy URL.

Image description



Twilio Studio Widgets

With our Asset’s URL copied, return to the Studio Circulation: Do you want scary motion pictures? Choose the “hi there” Widget we created earlier, and underneath Say or Play Message or Digits choose the Play a Message choice. Paste the URL of our asset into the URL of Audio File discipline. Click on Save and Publish the undertaking.

Use a second Collect Enter on Name Widget and place that after the “hi there” Widget.

Drag and drop a Cut up Primarily based On… Widget after the second Collect Enter On Name Widget. Join the widgets in order that the Transition flows from Consumer Pressed Keys, Consumer Mentioned One thing, and No Enter and into the Cut up Primarily based On... Your Circulation ought to now seem like this:

Image description

The Cut up Primarily based On… Widget permits you to cut up your Circulation based mostly on person circumstances. However first, it must reference a variable, or worth that’s being examined. Set the Variable to Take a look at to widgets.gather_2.SpeechResult. This references the caller enter gathered from the second Collect Enter On Name Widget.

Subsequent, with the Cut up Primarily based On… Widget chosen, navigate to the Transitions tab the place you’ll be able to configure person circumstances (which cut up your Circulation). Click on the + button, set the choice to If Worth Comprises, and enter the worth “who”.

Image description

Create two extra Say/Play Widgets. Join considered one of these Widgets to the No Situation Matches of the Cut up Primarily based On… and join the opposite to the If worth accommodates who. Your Circulation ought to now seem like this:

Image description

If the person says the phrase “who”, we wish our name to reply with “you inform me your identify I’ll let you know mine”. If there isn’t any match, we wish our name to reply with “do you want scary motion pictures?”

Much like earlier steps, once we used Twilio Belongings to add audio recordsdata, we’ll do the identical factor right here. Try to discover these clips on-line or report your personal voice to spook potential callers.

Iterate on the undertaking so as to add your personal interactions, then click on the Publish button to publish the Twilio Studio Circulation.



Have Enjoyable on Halloween

You could have the instruments to construct this spooky undertaking, now go forward and use it to scare your folks on Halloween! Customise it to your liking or use my undertaking by texting +1 (940) 394-8137.

Thanks a lot for studying! For different Halloween themed tutorials, seek for “Halloween” on the Twilio Weblog. If you happen to discovered this tutorial useful, have any questions, or wish to present me what you’ve constructed, let me know on-line. And if you wish to be taught extra about me, try my intro weblog submit.

Image description

Twitter @anthonyjdella
Linkedin @anthonydellavecchia
GitHub @anthonyjdella
TikTok @anthonyjdella
Medium @anthonyjdella
Dev.to @anthonyjdella
Electronic mail adellavecchia@twilio.com
Private Web site anthonydellavecchia.com



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments