Pub build status

Unofficial Dart library for building Alexa skills as Web services.

Again, this is not an Amazon product.


The main functionality of this library is providing JSON models and constants that correspond to all of the standard request and response types for Alexa. In addition, there is a high-level API built on this foundation that closely resembles the official Java SDK.

See example/example.dart for an example Hello world server that you can run directly, using package:shelf.

TODO: More docs here

High Level Usage

The high-level API closely follows the official Java SDK, and provides:

  • Request handler classes and infrastructure
  • Session/request/persistent storage infrastructure
  • A package:shelf adapter

Below is a contrived example, using RequestHandler classes and the AlexaSkill wraper class:

class HelloWorldHandler extends AlexaLaunchRequestHandler {
  bool canHandleTyped(
          AlexaHandlerInput handlerInput, AlexaLaunchRequest request) =>

  AlexaResponseEnvelope handleTyped(
      AlexaHandlerInput handlerInput, AlexaLaunchRequest request) {
    return handlerInput.responseBuilder
        .withSpeech('Hello, world!')

main() async {
  var skill = AlexaSkill()..requestHandlers.add(HelloWorldHandler());
  await shelf_io.serve(alexaSkillHandler(skill), '', 3000);
  print('Listening at');

Low Level Usage

Below is a contrived example:

var bodyAsMap = await parseRequestJson();
var requestEnvelope = alexaRequestEnvelopeSerializer.decode(bodyAsMap);
var responseEnvelope = AlexaResponseEnvelope();

if (requestEnvelope.requestType == AlexaRequestType.launchRequest) {
  // Send a basic text response.
  responseEnvelope.response = AlexaResponse(
    outputSpeech: AlexaOutputSpeech(
      type: AlexaOutputSpeechType.plainText,
      text: 'Hello, world!',
} else if (requestEnvelope.requestType !=
    AlexaRequestType.sessionEndedRequest) {
  // Do something...

  ..headers.contentType = ContentType.json