How to Speed Up Alexa Development

TribalScale Inc.
TribalScale
Published in
4 min readFeb 27, 2018

--

By Thomas Lui & Siddhartha Garg

TribalScale has been at the forefront of Voice technology. TribalScale has been named an expert builder by both Amazon and Google, and we’ve worked on some amazing projects for top brands across industries such as the PGA Tour and the CBC.

Developing on the Alexa platform is really cool because you can test on a voice recognition platform, but it can be tedious if not planned well in advance.

One of the painful points of developing with Alexa is the deployment of your source code every time you make a change. Typically, developers set up their AWS Lambda and Command Line Interface to deploy their changes and test them right away. But, as many of you know, this stops being fun when you have to deploy every single time you make a small change to the Lambda, it’s time consuming. This adds frustration and de-motivates developers to build useful and complicated applications. Moreover, to debug an error the developer needs to scan through CloudWatch on the AWS Lambda service which can be really exhausting to go through.

Fortunately, we have a few techniques to make the life of an Alexa developer easier: use Bespoken, adopt a serverless framework, and take advantage of the Amazon Alexa Test Simulator.

1. Bespoken

To escape the trouble of deploying to Lambda after every small code change, you can use Bespoken to your benefit. Bespoken generates an https server link, and the server and link can be used in your skill configuration. To setup and install bespoken run the below mentioned command:

npm install bespoken-tools -g

Now, in order to run the server, go to the terminal and run the command below:

bst proxy lambda index.js

You’ll notice an https link in the terminal just like in the screenshot below:

Use this https link in your skill configuration section to point to your source code. You’ll notice that when you invoke your skill, the terminal will start logging the request and responding to your skill. This makes the development super fast, and now you can easily debug any errors. Below is the skill configuration section for your reference.

2. Serverless framework

A Serverless Framework also takes the pain out of AWS Lambda deployment. It makes environment management and log monitoring easy. So, instead of manually zipping-up and uploading to AWS, you can just run one command to deploy your Lambda.

Setup:

Install the Serverless Framework via npm using this command

npm install serverless -g

Set up credentials through the AWS profile

serverless config credentials — provider aws — key <key> — secret <secret>

Key and secret can be found under IAM -> Users -> Security credentials

Deployment and Environment Management:

Create a serverless.yml in the root directory

service: sample-serverless-alexaprovider:
name: aws
runtime: nodejs6.10
functions:
sample:
handler: index.index

The serverless CLI let you configure which environment is best to deploy your Lambda. This will then deploy to a development environment

serverless deploy — stage dev

Logging:

Monitor logs in the terminal instead of monitoring through CloudWatch

serverless logs -f sample-function -t — stage dev

3. Testing using Simulator

Testing a Skill using the Alexa device can be slow, and sometimes it may be inaccurate if you’re working in a noisy environment. Instead, you can use the Amazon Alexa Test Simulator for quick requests and responses. Also, Amazon provides a beta simulator which behaves just like a device, except it cannot play live feeds. Using simulators can expedite the process of testing your code changes.

So in sum, we suggest implementing these three tips and techniques — using Bespoken, a serverless framework, and a simulator — to speed up and refine your Alexa development process. All three have advantages and will streamline your implementation and deployment for an all-round better quality and efficient product.

Thomas is an Agile Software Engineer who specializes in developing web and voice applications. He is interested in rock climbing and is obsessed with sneakers and cryptocurrency.

Siddhartha (Sid) is an Agile Software Engineer who specializes in developing Voice applications on Alexa and Google Home platform. He is a seasoned Javascript developer and holds interest in the stock market. Sid is a fitness enthusiast and in his free time he likes to cook Indian speciality food.

Join our fast growing Tribe and connect with us on Twitter, LinkedIn & Facebook! Learn more about us on our website.

--

--

TribalScale Inc.
TribalScale

A digital innovation firm with a mission to right the future.