Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phxql/aleksa
Aleksa is a small framework for writing Alexa Skills in Kotlin
https://github.com/phxql/aleksa
alexa echo kotlin skills
Last synced: 3 months ago
JSON representation
Aleksa is a small framework for writing Alexa Skills in Kotlin
- Host: GitHub
- URL: https://github.com/phxql/aleksa
- Owner: phxql
- License: lgpl-3.0
- Archived: true
- Created: 2017-02-11T08:22:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-23T08:19:08.000Z (over 4 years ago)
- Last Synced: 2024-04-27T00:37:09.136Z (7 months ago)
- Topics: alexa, echo, kotlin, skills
- Language: Kotlin
- Size: 211 KB
- Stars: 35
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: docs/contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# Aleksa
Aleksa is a small framework for writing [Alexa Skills](https://developer.amazon.com/alexa-skills-kit) 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
```xml
de.mkammerer.aleksa
aleksa
1.2```
### 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:
```kotlin
// Inherit from SpeechletV2Base, it implements SpeechletV2 and implements optional methods with empty bodies
class HelloWorldSpeechlet : SpeechletV2Base() {
override fun onIntent(requestEnvelope: SpeechletRequestEnvelope): SpeechletResponse {
val intent = requestEnvelope.request.intentreturn 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): SpeechletResponse {
return ask("Hello world. What do you want to do?")
}
}
```Application:
```kotlin
// Start with --help to see available commandline options
fun main(args: Array) {
// 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](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
* [Functions](docs/functions.md)
* [Constants](docs/constants.md)## License
[LGPLv3](LICENSE)
## Contributing
See [contributing guidelines](docs/contributing.md).
## Maintainer
Moritz Kammerer ([phXql](https://github.com/phxql))