Skip to content

Instantly share code, notes, and snippets.

View danoventa's full-sized avatar

Daniel Anthony Noventa danoventa

View GitHub Profile
@danoventa
danoventa / interaction-model.json
Created October 10, 2018 16:28
Alexa Skill interaction model
{
"interactionModel": {
"languageModel": {
"invocationName": "my interaction model",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
const fetch = require('node-fetch');
module.exports = Alexa.CreateStateHandler(
'fetch_state',
Object.assign({}, genericHandlers, {
'FetchRequest': () =>
{
fetch('https://jsonplaceholder.typicode.com/posts/1')
.then(response => response.json())
.then(json => this.emit(':tell', `The title is: ${json.title} `)
const accountSid = 'YOUR TWILIO SID HERE';
const authToken = 'YOUR TWILIO AUTH TOKEN HERE';
const twilio = require('twilio');
const client = new twilio(accountSid, authToken);
module.exports = Alexa.CreateStateHandler(
'twilio_state',
Object.assign({}, genericHandlers, {
'SendSMS': () =>
module.exports = Alexa.CreateStateHandler(
'root_handler_state',
Object.assign({}, genericHandler, {
'LaunchRequest': () => this.emit(':ask', "Just keeping the session open")
})
);
module.exports = {
'AMAZON.HelpIntent': () => this.emit(':ask', 'Help Prompt', 'Help RePrompt'),
'AMAZON.StopIntent': () => this.emit(':tell', 'Bye!'),
'AMAZON.CancelIntent': () => {
this.response.speak('Ok, let\'s play again soon.');
this.emit(':responseReady');
},
'SessionEndedRequest': () => this.emit(':saveState', true)
};
const genericHandler = request('../generic_handler');
module.exports = Object.assign({}, genericHandler, {
'LaunchRequest': () => this.emit(':ask', "This skill has been launched!")
});
module.exports = {
SynonymValue: (slt, evt) => {
return evt
.request
.intent
.slots[slt]
.resolutions
.resolutionsPerAuthority[0]
.values[0]
.value
@danoventa
danoventa / index.js
Last active April 23, 2018 22:30
Point of contact for the Alexa App
'use strict';
const Alexa = require('alexa-sdk');
const constants = require('constants');
const rootHandler = require('rootHandler');
const otherHandler = require('otherHandler');
exports.handler = function(event, context, callback){
let alexa = Alexa.handler(event, context);
{
"interactionModel": {
"languageModel": {
"invocationName": "my example app",
"intents": [
{
"name": "RootRequest",
"slots": [{
"name": "pronoun",
"type": "pronoun"
@danoventa
danoventa / format_to_alexa_schema.py
Last active April 23, 2018 17:23
Used to format words or phrases that are separated by a white space, and add a new line and a comma.
```
words
to
scrape
```.replace('\n', ',\n')