./Sources/main.swift
Description: This project provides a demonstration of how to develop for the Amazon Echo. With this skill the user is capable to ask Alexa for the statistics of the enemy team in League of Legends the video game, and know what they should care about.
- macOS Sierra
- XCode 8.3.3
- Swift 3.1
- Ngrok
- CouchDB
- An Amazon developer account
- A League of Legends developer API Key
Go to the Alexa Developer Console and select Alexa Skill Kit. Click Add new skill.
The next steps show you what information is necessary on each Alexa tab. If you notice there is information missing just leave the field blank or their default values.
Skill Information
Name: lol assistant
Invokation name: League assistant
Interaction Model
- Click Launch Skill Builder
- Go to Code editor tab.
- Drag and drop InteractionModel.json.
- Apply changes.
- Save and build model.
- Go back to the skill configuation by clicking Configuration
Configuration
- Service Endpoint Type:
HTTPS
- Geographical region:
North America
/Europe
(Any)
- You will get the endpoint using ngrok. Check the next step for that.
In your terminal run
ngrok http 8081
You will get a https endpoint, which is the hook for your skill.
Before running the project, is recommended to have CouchDB running. By default, it runs on port 5984.
- Open you manager ( http://127.0.0.1:5984/_utils/ ), and under the admin panel create a new admin. Remember this credentials.
- Log out from CouchDB by clicking Log out just at the bottom of the page, left side.
- Open again the manager and log in with your credentials.
- Go to Databases and Create Database.
- Input the name of your desired Database and click Create. Super easy, right? Relax.
- Within your terminal clone the project, and cd the project directory.
- Copy ./Sources/AppConstants.swift.example as ./Sources/AppConstants.swift
- Edit that file by adding your LoL API Key in the apiKey filed.
- Edit the host and port of the database if it doesn't match with your configuration.
- Add the name of the database in the name field, also input your admin and password database in their respective fields.
Install dependences and build project with
swift build
If successful, run the project with
./.build/debug/SwiftEcho
Your server will run into the port 8081.
Also, you can generate the xcode project using.
swift package generate-xcodeproj
- Note, if you are coding withing xode, be sure to change the scheme before running. You should select the last SwiftEcho, and run on My Mac.
Back in the Alexa portal, we have the Test tab under your skill configuration. Go there. In the Service simulatour you can try different stuff to test your skill. Some examples are:
open league asistant
log in with ID two zero eight one seven three eight and region Latin America North
give me statistics
🍻