Code Monkey home page Code Monkey logo

serverless-aws-alexa-ts's Introduction

Serverless Template for Alexa Skill by Typescript

This is a template of Serverless framework for Alexa skill.

Overview

  • A template of Serverless Framework app for Alexa skill by Typescript
  • Build by webpack
  • Ready for tslint
  • Output source maps
  • Ready for TDD, by Jest with virtual-alexa
  • Config file enable
  • Support DynamoDB for Persistent Attributes.
    (Ready for DynamoDB local by using serverless-dynamodb-local)

Requirements

Usage

Setup

Run the following command.
You can create your serverless application for Alexa Skill, based on this template.

$ serverless install --url https://github.com/HeRoMo/serverless-aws-alexa-ts --name your-app-name
$ cd your-app-name
$ npm install

Config file

Copy config/config.yml.template to config/config.yml, and modify config.yml for your skill.

$ cp config/config.yml.template config/config.yml

Implement Requedt Handlers

There are basically request hander implementations in src/handlers. Please modify these files and add other handlers for your skill.

Writing SSML

This template include ssml-builder (with type difinition!). You can make SSML speach text easily by using this library. a tiny sample is in HelloIntentHandler.ts.

For details, please see ssml-builder.

Interaction Model Management

You can manage Interaction Model JSON file of your Skill.

At first, you should run ask-cli init for initialize ask-cli. For details, please see ask-cli document.

Next, create .npmrc file by the following command

$ echo 'skill_id = <your skill id>' > .npmrc

Then, you can get and update model by the following commands.

npm run ask:get-model    # get model json from Alexa console
npm run ask:update-model # put model json to console and rebuild  model

If you don't use ja_JP, please modify or add npm script of package.json for your skill language.

Testing

Using Jest test suite

This template includes Jest and virtual-alexa. See a sample implementation in alexa.spec.ts.

To execute the test suite, use npm test.

NOTICE: virtual-alexa use model json so you have to run npm run ask:get-model before test. ( This template has a sample model json. )

Using Debugger

If using Visual Studio Code, you can use debugger easy. This template has sample config. see .vscode/launch.json.

Deploy

Run the following command to deploy your hanlder to AWS Lambda.

$ npm run sls:deploy

DynamoDB

If you would like to use DynamoDB to persist attributes, uncomment the code for DynamoDB in index.ts and serverless.yaml.

Local DynamoDB

When testing and debugging, you can use local DynamoDB

Run the following command to install local DynamoDB.

$ npm run sls:dynamodb:install

Run the following command to install local DynamoDB.

$ npm run sls:dynamodb:start

For details, please see Serverless Dynamodb Local Plugin

License

MIT

serverless-aws-alexa-ts's People

Contributors

heromo avatar

Stargazers

Nate Bunney avatar Matt O'Donnell avatar Nedim Dedic avatar Takahiro Horike avatar

Watchers

James Cloos avatar Nate Bunney avatar  avatar  avatar

serverless-aws-alexa-ts's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.