Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed the sample for events

  • Loading branch information...
commit 82ea990fcec81fba15e4a0a30c40f79592d8572b 1 parent 991a946
Kevin Bond authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 samples/say-event-ask.js
View
12 samples/say-event-ask.js
@@ -12,8 +12,16 @@ var server = http.createServer(function (request, response) {
var tropo = new tropowebapi.TropoWebAPI();
tropo.say("Welcome to my Tropo Web API node demo.");
+ //Create event objects
+ var e1 = {"value":"Sorry, I did not hear anything.","event":"timeout"};
+ var e2 = {"value":"Sorry, that was not a valid option.","event":"nomatch:1"};
+ var e3 = {"value":"Nope, still not a valid response","event":"nomatch:2"};
+
+ //Create an array of all events
+ var e = new Array(e1,e2,e3);
+
// Demonstrates how to use the base Tropo action classes.
- var say = new Say("Please enter your 5 digit zip code.");
+ var say = new Say("Please enter your 5 digit zip code.", null, e, null, null, null);
var choices = new Choices("[5 DIGITS]");
// Action classes can be passes as parameters to TropoWebAPI class methods.
@@ -22,6 +30,6 @@ var server = http.createServer(function (request, response) {
// Render out the JSON for Tropo to consume.
response.writeHead(200, {'Content-Type': 'application/json'});
- response.end(tropowebapi.TropoJSON(tropo));
+ response.send(tropowebapi.TropoJSON(tropo));
}).listen(8000); // Listen on port 8000 for requests.
Please sign in to comment.
Something went wrong with that request. Please try again.