Skip to content

Instantly share code, notes, and snippets.

View joshskeen's full-sized avatar
💻
☕️

Josh Skeen joshskeen

💻
☕️
View GitHub Profile
var helloAlexaResponseFunction = function(intent, session, response) {
response.tell(SPEECH_OUTPUT);
};
GreeterService.prototype.intentHandlers = {
"HelloAlexaIntent": helloAlexaResponseFunction
};
@joshskeen
joshskeen / custom-slot-types-support.js
Created May 3, 2016 15:28
custom utterance support for an alexa-app skill
var skillService = new Skill.app('myskill');
var utterancesMethod = skillService.utterances;
skillService.utterances = function() {
return utterancesMethod().replace(/\{\-\|/g, '{');
};
skillService.intent('airportInfoIntent', {
'slots': {
'AIRPORTCODE': 'FAACODES'
AAC
AAE
AAF
AAH
AAI
AAJ
AAK
AAL
AAM
AAN
hysterical
hesitant
snobbish
incandescent
rural
attractive
troubled
unbiased
serious
pushy
'use strict';
module.change_code = 1;
var _ = require('lodash');
function MadlibHelper (obj) {
this.started = false;
this.madlibIndex = 0;
this.currentStep = 0;
this.madlibs = [
{
{
"version": "1.0",
"sessionAttributes": {},
"response": {
"shouldEndSession": true,
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>There is currently no delay at Hartsfield-Jackson Atlanta International. The current weather conditions are A Few Clouds, 51.0 F (10.6 C) and wind North at 0.0mph.</speak>"
}
},
{
"version": "1.0",
"sessionAttributes": {},
"response": {
"shouldEndSession": false,
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>I didn't have data for an airport code of PUNKYBREWSTER</speak>"
},
"reprompt": {
{
"version": "1.0",
"sessionAttributes": {},
"response": {
"shouldEndSession": false,
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>I didn't hear an airport code. Tell me an airport code.</speak>"
},
"reprompt": {
app.intent('airportinfo', {
'slots': {
'AIRPORTCODE': 'FAACODES'
},
'utterances': ['{|flight|airport} {|delay|status} {|info} {|for} {-|AIRPORTCODE}']
},
function(req, res) {
//get the slot
var airportCode = req.slot('AIRPORTCODE');
var reprompt = 'Tell me an airport code to get delay information.';
{
"intents": [
{
"intent": "airportinfo",
"slots": [
{
"name": "AIRPORTCODE",
"type": "FAACODES"
}
]