Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ネコのために webアプリと連携する スキルを作ってみた/alexa-for-cat-2018

ネコのために webアプリと連携する スキルを作ってみた/alexa-for-cat-2018

AAJUG Offline meetup vol.2

Hidetaka Okamoto

September 04, 2018
Tweet

More Decks by Hidetaka Okamoto

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • Digitalcube Co. Ltd. • AWS Samurai 2017 •

    ؔ੢ͷJAWS-UGӡӦϝϯόʔ H i d e t a k a O k a m o t o
  2. ask-sdkͰσʔλΛอଘ͢Δ async handle(handlerInput) { // σʔλͷอଘ const persistentAttributes = {

    name: '͓͔΋ͱ', age: 28 } ɹconst { attributesManager } = handlerInput await attributesManager.setPersistentAttributes(persistentAttributes) await attributesManager.savePersistentAttributes() … // σʔλͷऔΓग़͠
 const atts = await attributesManager.getPersistentAttributes() const { name, age } = atts …. }
  3. ask-sdkͰσʔλΛอଘ͢Δ async handle(handlerInput) { // σʔλͷอଘ const persistentAttributes = {

    name: '͓͔΋ͱ', age: 28 } ɹconst { attributesManager } = handlerInput await attributesManager.setPersistentAttributes(persistentAttributes) await attributesManager.savePersistentAttributes() … // σʔλͷऔΓग़͠
 const atts = await attributesManager.getPersistentAttributes() const { name, age } = atts …. }
  4. ask-sdkͰσʔλΛอଘ͢Δ async handle(handlerInput) { // σʔλͷอଘ const persistentAttributes = {

    name: '͓͔΋ͱ', age: 28 } ɹconst { attributesManager } = handlerInput await attributesManager.setPersistentAttributes(persistentAttributes) await attributesManager.savePersistentAttributes() … // σʔλͷऔΓग़͠
 const atts = await attributesManager.getPersistentAttributes() const { name, age } = atts …. }
  5. aws-sdk & ask-utilsͰσʔλΛอଘ͢Δ const AWS = require('aws-sdk') const { getUserId

    } = require('ask-utils') const dynamoDB = new AWS.DynamoDB.DocumentClient() const TableName = 'MyExampleDB' const SaveProfileHandler = { … async handle(handlerInput) { const userId = getUserId(handlerInput) const params = { TableName, Item: { id: userId, } } await dynamoDB.put(params).promise() ... } }
  6. aws-sdk & ask-utilsͰσʔλΛอଘ͢Δ const AWS = require('aws-sdk') const { getUserId

    } = require('ask-utils') const dynamoDB = new AWS.DynamoDB.DocumentClient() const TableName = 'MyExampleDB' const SaveProfileHandler = { … async handle(handlerInput) { const userId = getUserId(handlerInput) const params = { TableName, Item: { id: userId, } } await dynamoDB.put(params).promise() ... } }
  7. aws-sdk & ask-utilsͰσʔλΛอଘ͢Δ const AWS = require('aws-sdk') const { getUserId

    } = require('ask-utils') const dynamoDB = new AWS.DynamoDB.DocumentClient() const TableName = 'MyExampleDB' const SaveProfileHandler = { … async handle(handlerInput) { const userId = getUserId(handlerInput) const params = { TableName, Item: { id: userId, } } await dynamoDB.put(params).promise() ... } }