Skip to content

Instantly share code, notes, and snippets.

View germanviscuso's full-sized avatar
🏠
Working from home

German Viscuso germanviscuso

🏠
Working from home
View GitHub Profile
@germanviscuso
germanviscuso / index.js
Created November 26, 2019 11:39
hello world
// 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 LaunchRequestHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
},
handle(handlerInput) {
@germanviscuso
germanviscuso / index.js
Last active February 24, 2020 00:01
Example on how to user personId as primary key in an Alexa Persistence adapter
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
@germanviscuso
germanviscuso / gist:3f6f24644905d272ea3778b729bbf5e2
Created August 21, 2019 18:11
Personal AWS resources in Alexa Hosted Skills
How do I set up an Alexa-hosted skill to use resources on a personal AWS account?
With the AWS Lambda execution role ARN, you can seamlessly use resources on a personal AWS account to expand the functionality of your Alexa-hosted skill. For example, you can connect the Alexa-hosted skill to an Amazon DynamoDB table. Take the following steps to set up your Alexa-hosted skill to use resources on a personal AWS account:
In the Alexa developer console, open your Alexa-hosted skill, and then in the code editor click the icon that has hover text AWS Lambda Role Execution ARN. Copy the ARN.
If you have not done so already, on your personal AWS account, in the Identity and Access Management (IAM) dashboard, create a role that allows access to the resource that you want your Alexa-hosted skill to access.
In the IAM dashboard, click Roles, click the name of the role you want to edit, and then click the Trust relationships tab.
Edit the trust relationship to include the sts:AssumeRole action, and specify the AWS Lambda
@germanviscuso
germanviscuso / en-US.js
Created August 13, 2019 10:33 — forked from KayLerch/en-US.js
Optimized i18n request interceptor for Alexa custom skills in Node. Loads only required language assets from external files and provides some convenient functions to read them. Will also let you store localized settings represented as JSON objects in your language files.
module.exports = Object.freeze({
translation: {
welcome: 'Howdy',
images: [
{
background: 'https://image/en-US.png'
},
{
background: 'https://image/en-US2.png'
},
@germanviscuso
germanviscuso / test.java
Created June 27, 2019 10:22
Progressive Response in Java
sendProgressiveResponseMessage("Please wait!", handlerInput);
public static void sendProgressiveResponseMessage(final String message,
final HandlerInput handlerInput){
final SpeakDirective speakDirective = SpeakDirective.builder()
.withSpeech(message)
.build();
final String requestId = handlerInput.getRequestEnvelope().getRequest().getRequestId();
@germanviscuso
germanviscuso / aplcard.js
Last active November 17, 2020 17:28
Sí mi Capitán - Alexa Games workshop
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 / README.md
Created May 13, 2019 21:09
Use VS Code as diff tool, git diff tool and git editor

code --diff file1.cs file2.cs

git config --global diff.tool vscode git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"

git config --global core.editor "code --wait"

@germanviscuso
germanviscuso / es-ES.json
Created April 3, 2019 22:20
Alexa Skills Basic: Intent Chaining
{
"interactionModel": {
"languageModel": {
"invocationName": "feliz cumple",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
@germanviscuso
germanviscuso / README.md
Last active November 25, 2023 21:21
DynamoDB connection from an Alexa skill

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 / es-ES.json
Last active October 15, 2023 21:32
Technovation Workshop (Advanced Fact - es-ES)
{
"interactionModel": {
"languageModel": {
"invocationName": "curiosidades espaciales",
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{