Aleksa is a small framework for writing Alexa Skills in Kotlin

Overview

Aleksa

Aleksa is a small framework for writing Alexa Skills in Kotlin.

Warning

This framework uses an old version of the Alexa SDK - skills built with it won't work with Alexa anymore.

Usage

Maven

<dependency>
    <groupId>de.mkammerer.aleksagroupId>
    <artifactId>aleksaartifactId>
    <version>1.2version>
dependency>

Gradle

compile group: 'de.mkammerer.aleksa', name: 'aleksa', version: '1.2'

Features

  • Embedded Jetty server
  • Configurable via code or commandline flags
  • Supports hosting multiple skills in one application
  • Convenience functions for plaintext responses, SSML, repromts, slots, sessions and more
  • Dev mode which simplifies skill testing while development
  • TLS
  • Metrics

Example

Speechlet implementation:

tell("Hello world") // The BuiltInIntents object contains the Alexa built-in intents BuiltInIntents.CANCEL, BuiltInIntents.STOP -> tell("Good bye") // use the ask function to create an ask response else -> ask("What do you want to do?") } } override fun onLaunch(requestEnvelope: SpeechletRequestEnvelope ): SpeechletResponse { return ask("Hello world. What do you want to do?") } }">
// Inherit from SpeechletV2Base, it implements SpeechletV2 and implements optional methods with empty bodies
class HelloWorldSpeechlet : SpeechletV2Base() {
    override fun onIntent(requestEnvelope: SpeechletRequestEnvelope<IntentRequest>): SpeechletResponse {
        val intent = requestEnvelope.request.intent

        return when (intent.name) {
        // use the tell function to create a tell response
            "HelloWorldIntent" -> tell("Hello world")
        // The BuiltInIntents object contains the Alexa built-in intents
            BuiltInIntents.CANCEL, BuiltInIntents.STOP -> tell("Good bye")
        // use the ask function to create an ask response
            else -> ask("What do you want to do?")
        }
    }

    override fun onLaunch(requestEnvelope: SpeechletRequestEnvelope<LaunchRequest>): SpeechletResponse {
        return ask("Hello world. What do you want to do?")
    }
}

Application:

// Start with --help to see available commandline options
fun main(args: Array<String>) {
    // Create your speechlet
    val speechlet = HelloWorldSpeechlet()
    // Add the speechlet to Aleksa
    Aleksa.addSpeechlet(path = "/helloworld", applicationId = "[Your skill id]", speechlet = speechlet)
    // Start Aleksa with the commandline parameters of your application
    Aleksa.start(args)
}

Run it with --interface 127.0.0.1 --port 8080 --dev. Now you can test the skill with curl or some other tool at the url http://127.0.0.1:8080/helloworld.

If you don't specify any commandline arguments, it binds to all interfaces on port 8080 and without dev mode. The dev mode disables request signature checking, timestamp checking and application id verification. It also shows some information on / to ease debugging infrastructure problems (reverse proxies, etc.).

If you want metrics (statistics on how often your skills are executed), add --metrics and check the /metrics endpoint.

For more examples see the examples directory.

Commandline parameters

 -d,--dev                          Enable development mode
 -h,--help                         Prints help
 -i,--interface 
   
                  Interface to bind to
 -ka,--key-alias 
    
                  Key alias. If not set, a key will be
                                   automatically selected
 -kpw,--key-password 
     
               Key password. If not set, the keystore
                                   password will be used
 -ks,--keystore 
      
                     Location to the keystore
 -kspw,--keystore-password 
       
         Keystore password -m,--metrics Enable metrics -p,--port 
        
          Port to bind to 
        
       
      
     
    
   

Documentation

License

LGPLv3

Contributing

See contributing guidelines.

Maintainer

Moritz Kammerer (phXql)

You might also like...
an open source algorithmic trading framework written in Kotlin for anyone serious about algo-trading
an open source algorithmic trading framework written in Kotlin for anyone serious about algo-trading

Roboquant Roboquant is an algorithmic trading platform that is fast and flexible while at the same time strives to be easy to use. It is fully open so

A simple MVI framework for Kotlin Multiplatform and Android
A simple MVI framework for Kotlin Multiplatform and Android

Orbit Multiplatform Get in touch What is Orbit Orbit is a Redux/MVI-like library - but without the baggage. It's so simple we think of it as MVVM+. Si

The Okila server project uses the Spring boot framework and uses the Kotlin language

Okila-Server The Okila server project uses the Spring boot framework and uses the Kotlin language Format Response //The response successfully format

A modular framework for building Discord bots in Kotlin using Kordex and Kord

Mik Bot A modular framework for building Discord bots in Kotlin using Kordex and Kord **If you are here for mikmusic, click here and there Deployment

MaxonBank is a Kotlin + Spring Boot + Axon Framework application that supports opening, depositing to, and withdrawing from accounts.

MaxonBank MaxonBank is a Kotlin + Spring Boot + Axon Framework application that supports opening, depositing to, and withdrawing from accounts. The ap

LittleKt - An OpenGL game framework written in Kotlin

LittleKt - A 2D game framework written in Kotlin Currently in development. Littl

KotlinDL - High-level Deep Learning Framework written in Kotlin and inspired by Keras

Оригинальный репозиторий https://github.com/JetBrains/KotlinDL KotlinDL: High-le

A pragmatic lightweight dependency injection framework for Kotlin developers.
A pragmatic lightweight dependency injection framework for Kotlin developers.

A pragmatic lightweight dependency injection framework for Kotlin developers. Koin is a DSL, a light container and a pragmatic API

Consumer desktop from nutrition-framework API
Consumer desktop from nutrition-framework API

About This Project (work-in-progress 👷 🔧️ 👷‍♀️ ⛏ ) Consumer Dari Nutrition Framework General Framework for Application Development Around Nutrition

Owner
Moritz Kammerer
Backend developer at @qaware. Loves creating software, even at home.
Moritz Kammerer
GraphQL Jetpack - A collection of packages for easily writing Java GraphQL server implementations

GraphQL Jetpack A collection of packages for easily writing Java GraphQL server

Ryan Yang 18 Dec 2, 2022
NFC NDEF Reader and Writer. there are two separate activities for reading and writing.

kotlin-nfc-sample NFC NDEF Reader and Writer. there are two separate activities for reading and writing. Steps Clone the Project Open with Android Stu

null 2 Oct 1, 2022
WriterAI is an AI-based content writing tool

WriterAI is an AI-based content writing tool that can turn your unstructured text into engaging content and generate up to 5 different paragraphs with an input of just 5 words! Using the power of artificial intelligence, this tool helps you write an engaging piece of content and end up with something professional. You can use it for writing emails, blogs, articles, letters, thesis and even e-books! It is completely free to use and open-source :)

Vaibhav Jaiswal 21 Dec 26, 2022
Small kotlin library for persisting _single instances_ of kotlin data classes

PerSista Small library for persisting single instances of kotlin data classes. NB: PerSista uses typeOf() internally which is marked as @ExperimentalS

Eric Donovan 5 Nov 13, 2022
A small backend for the Thinkrchive app written in Kotlin with Ktor

A small backend for the Thinkrchive app written in Kotlin with Ktor. It uses Postgresql with a few requests and JWT authentication for admins.

Thinkrchive 6 Dec 12, 2022
A small application for working with the Github API, made as a practical task. GeekBrains, course of study: Popular libraries: RxJava 2, Dagger 2, Moxie.

GeekBrains_Course_AndroidOnKotlin_HW_My_Movie Домашнее задание к занятию №2-6 Студента GeekBrains Веремеенко Дмитрия Факультет: Android-разработки Кур

Dmitriy 3 Aug 24, 2021
Ksp-di-library - Small library for DI in KMM apps

DI-KSP Small library for DI in KMM apps. Uses KSP for processing DI annotations:

Anna Zharkova 3 Feb 6, 2022
Chain Relations is a small casual existential game about life, human needs and long-term relations.

Chain Relations Chain Relations is a small casual existential game about life, human needs and long-term relations. ChainRelations.360p.mp4 Game objec

Andrzej Novosiolov 4 Dec 2, 2022
Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

JetBrains 10k Jan 7, 2023
A Modern Kotlin-Ktor RESTful API example. Connects to a PostgreSQL database and uses Exposed framework for database operations.

kotlin-ktor-rest-api A Modern Kotlin-Ktor RESTful API example. Connects to a PostgreSQL database and uses Exposed framework for database operations. F

Selim Atasoy 32 Dec 20, 2022