0.3.13 • Published 3 years ago

@chitchatjs/alexa v0.3.13

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@chitchatjs/alexa

npm.io

🤖 JavaScript framework for building voice user interfaces for Alexa Skills. | 📄 Read the documentation

PackageNPMBuild
@chitchatjs/clinpm versionBuild Status
@chitchatjs/alexanpm versionBuild Status
@chitchatjs/corenpm versionBuild Status

Get in touch

gitter

Prerequisites

Chitchat requires the following dependencies:

Installation

npm i @chitchatjs/alexa --save

Writing a simple skill

To get started, simply write this in your index.ts

import { ax } from "@chitchatjs/alexa";

let state = ax.start().block(ax.say("Hello world")).build();

// create our skill using the state above
let skill = ax.skill().addState(state).build();
exports = ax.dialogManager(skill).exports();

Output:

U: open <skill-name>
A: Hello world

Let's add a dialog turn to ask user their name:

let state = ax
  .start()
  .block(
    ax
      .compound()
      .add(ax.whenLaunch().then(ax.ask("Hello, what is your name?").build()).build())
      .add(
        ax
          .whenUserSays(["my name is {name}"])
          .withSlotType("name", builtins.SlotType.FirstName)
          .then(ax.say("Welcome, {name}! It's nice to talk to you."))
          .build()
      )
      .build()
  )
  .build();

Output:

U: open <skill name>
A: Hello, what is your name?
U: my name is kevindra
A: Welcome, kevindra! It's nice to talk to you.

Build and deploy using ChitchatJS CLI:

> tsc
> cjs build
> cjs deploy

That's it!

Deploy to your stack using code

Wrap this in your stack module and deploy as code:

const handler = ax.dialogManager(skill).handler();

AWS Lambda

import { Function, Runtime, AssetCode, Code } from "@aws-cdk/aws-lambda";

// ...
this.lambdaFunction = new Function(this, props.functionName, {
  functionName: props.functionName,
  handler: "handler.handler",
  runtime: Runtime.NODEJS_10_X,
  code: new AssetCode(`./src`), // points to your skill module
  memorySize: 512,
  timeout: Duration.seconds(10),
});

Express JS

import * as express from "express";
import skill from "./src/skill";

const app = express();
const port = 3000;

app.get("/", skill.express());

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
});

Packages

  1. chitchat.js core library
  2. chitchat.js alexa library
  3. chitchat.js cli

Sample Skills

  1. Hello bot
  2. Dog Matcher
  3. High log game
  4. Coffee shop
  5. Workout Buddy

Plugins

  1. @chitchatjs/plugin-ax-common
  2. @chitchatjs/plugin-ax-session
  3. @chitchatjs/plugin-ax-display
  4. @chitchatjs/plugin-ax-card

Check the official documentation of available building blocks and much more here - https://chitchat.js.org/

0.3.13

3 years ago

0.3.12

4 years ago

0.3.11

4 years ago

0.3.10

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.0.24

4 years ago

0.1.0

4 years ago

0.2.0

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.9

4 years ago

0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago