Created
February 8, 2017 12:21
-
-
Save ObjectIsAdvantag/945519639cae8ebf5b36e6cb69b3543a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
say("Thank you for calling the random message hotline"); | |
function pickRandomQuote() { | |
var quotes = [ | |
"Speech was given to man to disguise his thoughts.", | |
"The adjective is the banana peel of the parts of speech." | |
]; | |
return quotes[Math.floor(Math.random() * quotes.length)]; | |
} | |
ask("Please enter your phone number followed by the pound sign", { | |
choices: "[9-12 DIGITS]", | |
terminator: "#", | |
mode: "dtmf", | |
onChoice: function (event) { | |
var quote = pickRandomQuote(); | |
message(randomQuote, { | |
to: event.value, | |
network: "SMS" | |
}); | |
say("Your message has been sent to +" + event.value); | |
hangup(); | |
}, | |
onBadChoice: function (event) { | |
say("Sorry, your entry is not a valid number. Goodbye"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment