Skip to content

Instantly share code, notes, and snippets.

@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 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 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";
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 / guitar-tuner.js
Created April 18, 2018 15:24
The lambda code to the Guitar Tuner skill we are building
/* This code has been generated from your interaction model
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
// There are three sections, Text Strings, Skill Code, and Helper Function(s).
// You can copy and paste the contents as the code for a new Lambda function, using the alexa-skill-kit-sdk-factskill template.
// This code includes helper functions for compatibility with versions of the SDK prior to 1.0.9, which includes the dialog directives.
@muttoni
muttoni / index.js
Last active February 5, 2018 14:36
Dog Translator Sample Skill
//LAMBDA CODE!
/* This code has been generated from your interaction model
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
// There are three sections, Text Strings, Skill Code, and Helper Function(s).
// You can copy and paste the contents as the code for a new Lambda function, using the alexa-skill-kit-sdk-factskill template.
// This code includes helper functions for compatibility with versions of the SDK prior to 1.0.9, which includes the dialog directives.
@muttoni
muttoni / index.js
Created January 15, 2018 14:57
Math Helper
/* This code has been generated from your interaction model
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
// There are three sections, Text Strings, Skill Code, and Helper Function(s).
// You can copy and paste the contents as the code for a new Lambda function, using the alexa-skill-kit-sdk-factskill template.
// This code includes helper functions for compatibility with versions of the SDK prior to 1.0.9, which includes the dialog directives.
{
"languageModel": {
"types": [
{
"name": "RANDOM",
"values": [
{
"id": null,
"name": {
"value": "to be honest",
@muttoni
muttoni / supports-display.js
Created November 15, 2017 10:46
Check if Alexa requests supports Render Templates
function supportsDisplay() {
var hasDisplay =
this.event.context &&
this.event.context.System &&
this.event.context.System.device &&
this.event.context.System.device.supportedInterfaces &&
this.event.context.System.device.supportedInterfaces.Display
return hasDisplay;
}
/* This code has been generated from your interaction model
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
// There are three sections, Text Strings, Skill Code, and Helper Function(s).
// You can copy and paste the contents as the code for a new Lambda function, using the alexa-skill-kit-sdk-factskill template.
// This code includes helper functions for compatibility with versions of the SDK prior to 1.0.9, which includes the dialog directives.