- Create a client app in congnito identity pool for Alexa
- Click on create secret key while creating app
- Check “Enable sign-in API for server-based authentication (ADMIN_NO_SRP_AUTH)”
- Go to “Client apps settings” and check “Cognito User Pool”
- In “Callback URL”field, add “https://alexa.amazon.co.jp/spa/skill/account-linking-status.html?vendorId=M1Q4KJDIT6UMXS”
- In “Allowed OAuth Flows “, check “Auth code grant”
- Check all 5 below scopes
- Share the
- Cognito Domain
- Alexa Client app’s client id and secret id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Alexa = require('alexa-sdk'); | |
const APP_ID = process.env.ALEXA_ID; | |
const messages = { | |
greeting: 'Welcome to Dummy Skill', | |
goodByMsg: 'Goodbye', | |
reprompt: 'Sorry, I wasn\'t able to hear that, can you please repeat it?', | |
help: 'This is a dummy skill for showcasing Account Linking' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"interactionModel": { | |
"languageModel": { | |
"invocationName": "dummy skill", | |
"intents": [ | |
{ | |
"name": "AMAZON.FallbackIntent", | |
"samples": [] | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWS_ENVIRONMENT= | |
AWS_ACCESS_KEY_ID= | |
AWS_SECRET_ACCESS_KEY= | |
AWS_ROLE_ARN= | |
AWS_REGION= | |
AWS_FUNCTION_NAME=skill-name | |
AWS_HANDLER=index.handler | |
AWS_MEMORY_SIZE=128 | |
AWS_TIMEOUT=10 | |
AWS_DESCRIPTION= |
Simple running above file via node will show the name of organisation with address and rounded distance from Centre London in KMs.
node findNearestOffices.js
By deafult, it fetches offices within 100km of Centre London, but it is configurable. For eg, to find offices within 500km of Centre London, pass it as env variable like,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const deepClone = (params) => { | |
const { dataToClone } = params; | |
if (typeof dataToClone !== 'object') throw new Error('dataToClone must be of Object type') | |
return Object.assign({}, dataToClone); | |
}; | |
const clonedData = deepClone({ | |
dataToClone: { | |
name: { first: 'Mukul', last: 'Jain' }, | |
location: 'New Delhi', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const AWS = require('aws-sdk'); | |
const s3 = new AWS.S3({ | |
accessKeyId: process.env.AWS_ACCESS_KEY, | |
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY | |
}); | |
const fileName = 'contacts.csv'; |