Twilio Router
(Note: this project was heavily inspired by Speech router)
Twilio Router is a wrapper for Twilio's SMS APIs. It enables you to declare "routes" which map speech to functionality within your Express application.
Usage
app
API
new TwilioRouter(properties)
Constructor. All properties
will be copied onto the object. properties
should contain a routes
hash that maps formats to functions:
The function can either be a string that maps to a function or an inline function. The format can contain parameters:
:param
Matches any text not containing whitespace*param
Matches any text (with/without spaces)(optional)
Makes the selection optional (i.e., the route will fire the associated function regardless of whether or not the given text is found)
route(transcript, callback)
Associate the given callback function with the given format. This can be used to add routes on the fly. If the first argument is an object instead of a string, it is assumed that it is a hash of routes, similar what is expected in the constructor.
router;
trigger(transcript)
Manually invoke the function associated with a transcript. This function is also used internally to invoke functions associated with a speech recognition transcript.
router;