Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

German Viscuso germanviscuso

🏠
Working from home
  • Amazon
  • Madrid
View GitHub Profile
@germanviscuso
germanviscuso / aplcard.js
Last active Nov 17, 2020
Sí mi Capitán - Alexa Games workshop
View aplcard.js
const APLHomeCardRequestInterceptor = {
process(handlerInput) {
const withSimpleCard = handlerInput.responseBuilder.withSimpleCard;
const withStandardCard = handlerInput.responseBuilder.withStandardCard;
function withSimpleAPLCard(cardTitle, cardContent){
if(supportsAPL(handlerInput)){
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
version: '1.0',
document: APLDoc,
@germanviscuso
germanviscuso / index.js
Created Nov 13, 2020
Alexa Node SDK Navigation Directive
View index.js
return handlerInput.responseBuilder
.speak('Starting navigation')
.addDirective({
type: 'Navigation.SetDestination',
destination: {
singleLineDisplayAddress: "Calle de San Mateo 13, 28004",
multipleLineDisplayAddress: "Calle de San Mateo 13, 28004",
name: "Museo del Romanticismo",
coordinate: {
latitudeInDegrees: 40.425860,
@germanviscuso
germanviscuso / README.md
Last active Aug 26, 2020
DynamoDB connection from an Alexa skill
View README.md

Alexa Skill Persistence with DynamoDB

This document covers how to use Dynamo DB persistence in your Alexa skill using a direct connection the AWS SDK rather than using the ASK SDK persistence adapter (you can see how to use the adapter here).

Setup w/ ASK CLI

About

This readme assumes you have your developer environment ready to go and that you have some familiarity with CLI (Command Line Interface) Tools, AWS, and the ASK Developer Portal.

@germanviscuso
germanviscuso / en-US.json
Last active Aug 22, 2020
Alexa Skill Basics: Global Persistence with the DynamoDB persistence adapter or the S3 Persistence adapter
View en-US.json
{
"interactionModel": {
"languageModel": {
"invocationName": "global persistence demo",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
@germanviscuso
germanviscuso / TwoASK-CLIs.md
Last active Jun 18, 2020
Use old and new ASK-CLIs in parallel (Alexa Skills Kit Command Line Interface)
View TwoASK-CLIs.md

I advise that if the VSCode plugin supports the ask-cli v2 then use Method 1. If we're not there yet then use Method 2 if you want the VSCode plugin to work. If you don't care about the plugin just go with Method 1.

Method 1

After following these instructions the old ask-cli v1.7.23 will run via the command ask1 and the latest ask-cli v2 via the command ask. You will be able to update the ask-cli v2 as usual. You can skip all steps below to create the npm package by just doing:

View TermsOfUse
General
This Terms of Use are an agreement between you (the "user") and German Viscuso (“us” or “we”). Before using any of our Alexa Skills (“our skills”), please read this agreement and our Alexa Skills Privacy Policy as well as the Alexa Terms of Use by the Amazon Digital Services LLC (with its affiliates, “Amazon”).
Regarding Amazon, “Alexa” means their Alexa Voice Service which includes third party services (like our skills) and other related Software.
If you use one of our skills you fully agree to this Terms of Use.
Disclaimer
View PrivacyPolicy
This privacy policy describes how German Viscuso (“us” or “we”) protects your (“you”, “the user”) privacy and your data. Before using any of our Alexa Skills (“our skills”), please read this policy and our Alexa Skills Terms of Use, as well as the Alexa Terms of Use and the Privacy Policies by the Amazon Digital Services LLC (with its affiliates, “Amazon”).
Regarding Amazon, “Alexa” means their Alexa Voice Service which includes third party services (like our skills) and other related Software.
If you use one of our skills you fully agree to this privacy policy.
General
@germanviscuso
germanviscuso / example-query.js
Created Apr 4, 2020 — forked from thetrevorharmon/example-query.js
Query JSON with S3 Select in Node.js
View example-query.js
// See tth.im/s3json for a full explanation of this code
const AWS = require('aws-sdk');
const S3 = new AWS.S3();
exports.handler = async (_, context) => {
try {
const query = 'SELECT * FROM s3object[*].results[*] r;';
// test query is against data from https://swapi.co/api/planets/?page=2
@germanviscuso
germanviscuso / index.js
Last active Feb 24, 2020
Quick code to support an intent that plays long form audio in an Alexa skill
View index.js
var stream = {
"token": "my_token", // no auth token, you decide what this is
"url": 'https://my_song.mp3',
"metadata" : {
"title": "My Song Title",
"subtitle": "My Song Subtitle",
"art": {
"sources": [
{
"contentDescription": "image",
@germanviscuso
germanviscuso / index.js
Last active Feb 24, 2020
Example on how to user personId as primary key in an Alexa Persistence adapter
View index.js
function getPersistenceAdapter() {
// This function is an indirect way to detect if this is part of an Alexa-Hosted skill
function isAlexaHosted() {
return !!process.env.S3_PERSISTENCE_BUCKET;
if (isAlexaHosted()) {
const {S3PersistenceAdapter} = require('ask-sdk-s3-persistence-adapter');
return new S3PersistenceAdapter({
bucketName: process.env.S3_PERSISTENCE_BUCKET,
objectKeyGenerator: keyGenerator
You can’t perform that action at this time.