Skip to content

Instantly share code, notes, and snippets.

const request = handlerInput.requestEnvelope.request;
const responseBuilder = handlerInput.responseBuilder;
let sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
// delegate to Alexa to collect all the required slots
const currentIntent = request.intent;
if (request.dialogState && request.dialogState !== 'COMPLETED') {
return handlerInput.responseBuilder
.addDelegateDirective(currentIntent)
.getResponse();
@muttoni
muttoni / index.js
Created September 6, 2018 14:01
times-tables
// Lambda Function code for Alexa.
// Paste this into your index.js file.
const Alexa = require("ask-sdk");
const https = require("https");
const invocationName = "multiplication test";
@muttoni
muttoni / index.js
Last active September 12, 2018 09:17
salva-amicizia
// Lambda Function code for Alexa.
// Paste this into your index.js file.
const Alexa = require("ask-sdk");
const https = require("https");
const invocationName = "salva amicizia";
@muttoni
muttoni / index.js
Created October 23, 2018 09:25
Quote of the Day Sample
/* eslint-disable func-names */
/* eslint-disable no-console */
const Alexa = require('ask-sdk');
const GetQuoteHandler = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return request.type === 'LaunchRequest'
|| (request.type === 'IntentRequest'
@muttoni
muttoni / index.js
Last active December 5, 2018 14:03
Swear Jar Skill
/* eslint-disable func-names */
/* eslint-disable no-console */
const Alexa = require('ask-sdk');
const ISworeIntentHandler = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return request.type === 'LaunchRequest'
|| (request.type === 'IntentRequest'
/* eslint-disable func-names */
/* eslint-disable no-console */
const Alexa = require('ask-sdk');
const LaunchRequestHandler = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return request.type === 'LaunchRequest';
},
// INTERCEPTOR -- add this in your request interceptor to auto-populate ISPs in your session attributes.
let sessionAttributes = handlerInput.attributesManager.getSessionAttributes() || {};
if (handlerInput.requestEnvelope.session['new'] || !sessionAttributes.inSkillProducts) {
let inSkillProductArray, persistentAttributes, ispObject;
// first populate ISP info
try {
@muttoni
muttoni / index.js
Last active March 11, 2019 15:28
NumberGeek
// This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK (v2).
// Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management,
// session persistence, api calls, and more.
const Alexa = require('ask-sdk-core');
const fetch = require('node-fetch');
const LaunchRequestHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
},
@muttoni
muttoni / index.js
Created March 13, 2019 14:56
Country, Capital or City - Copyright © 2019 Daphne
// This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK (v2).
// Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management,
// session persistence, api calls, and more.
const Alexa = require('ask-sdk-core');
const game_data = {
'cambridge' : 'city',
'london' : 'capital',
'england' : 'country',
'milan' : 'city',
// This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK (v2).
// Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management,
// session persistence, api calls, and more.
const Alexa = require('ask-sdk-core');
const persistenceAdapter = require('ask-sdk-s3-persistence-adapter');
const {
getSlotValue
} = require('ask-sdk-core');