Skip to content

Instantly share code, notes, and snippets.

@ObjectIsAdvantag
Created February 8, 2017 12:21
Show Gist options
  • Save ObjectIsAdvantag/945519639cae8ebf5b36e6cb69b3543a to your computer and use it in GitHub Desktop.
Save ObjectIsAdvantag/945519639cae8ebf5b36e6cb69b3543a to your computer and use it in GitHub Desktop.
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