In this module we show how to access internal ASK APIs (in this case the User Profile API to fetch the given name of the user and the Settings API to fetch the timezone of the device). We also intriduce some SSML magic to use speechcons and audio files.
- Build Tab: enable Given Name permissions in the skill
- Code Tab: create interceptors file
- Code Tab: move interceptors to separate file (interceptors.js), move persistence adapter to util.js
- Code Tab: add given name retrieval interceptor in interceptors.js, add it to exports in index.js
- Code Tab: add timezone retrieval interceptor in interceptors.js, add it to exports in index.js
- Code Tab: add speechcon and sound from audio bank to localization file
- Code Tab: add extra variable on localization strings to pass given name
- Code Tab: add API client to exports (because we're using a custom builder). See: https://developer.amazon.com/blogs/alexa/post/a47f25e9-3e87-4afd-b632-ff3b86febcd4/skill-builder-objects-to-customize-or-not-to-customize
- Service API (User Profile API - given name)
- Settings API (timezone)
- SSML (speechcons and audio files)
- Array capable localisation interceptor
- String replacement with plurals support
- lambda/custom/interceptors.js: add this file and move all interceptors here (plus several require()s, check the top of interceptors.js). Add interceptors to fetch the user first name and timezone and put the values in session attributes. Add constant for given name permission
- skill.json: we add this file so we show we require given name permission but you don't need it in an AHS
- lambda/custom/localisation.js: modify messages to include given name as replacement string. Modify goodbye message to include an array of goodbyes. Add message to say timezone could not be retrieved. Add sound and speechcon to birthday greeting message.
- lambda/custom/index.js: add requires for persistence.js and interceptors.js. Remove requires for localisation and i18next. Remove all interceptors above skill builder (they all go to interceptors.js)
- lambda/custom/util.js: move getPersistanceAdapter() function here from index.js