# Debugging Python voice apps locally with Bespoken

This tutorial shows you how to get started developing with bst for Alexa Skills Kit in Python using Flask-Ask (opens new window).

# Prerequisites

# Getting Started

We will use the tidepooler sample John provides (opens new window) in the Flask-Ask repo..

Clone the repo:

$ git clone https://github.com/johnwheeler/flask-ask.git

And jump to the root of the tidepooler sample:

$ cd flask-ask/samples/tidepooler/

and start the local server for the skill:

$ python tidepooler.py

The tidepooler skill is now running on your local machine, listening on port 5000.

# Start bst proxy

Open a new terminal and start the bst proxy:

$ bst proxy http 5000

where http is the protocol for the proxy and 5000 is the port the tidepooler skill server is listening on.

# Configure your Skill

From the Alexa Skills Kit list (opens new window) within the Amazon Developer's Console:

Click on the "Create Skill" button

Fill out the Information tab

  • Give your skill a name, 'tidepooler' for example
  • Click on the "Create Skill" button

Leave the default "Start from scratch" option and click on "Choose"

Fill out the Interaction Model

  • Copy the Interaction Model from here (opens new window)
  • Click on the "JSON Editor" from the Interaction Model Options
  • Paste the Interaction Model
  • Click on the "Save Model" button
  • Click on the "Build Model" button

Configure the Endpoint

When you started the proxy, bst printed out a URL that you need to configure your skill:

$ bst proxy http 5000
BST: v2.3.14  Node: v8.9.4

Your public URL for accessing your local service:
(Be sure to put in your real path and other query string parameters!)

INFO  2016-09-12T17:34:52.202Z Connected - proxy.bespoken.tools:5000

Copy this URL as your endpoint, then:

  • Select the "Endpoint" option in your skill configuration
  • Select "HTTPS" for your service endpoint type
  • Paste the proxy url
  • On the SSL Certificate Option, select the middle option "My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority"

# Test

  • Go to the "Test" tab in the skill Configuration
  • Enable testing for development by clicking in the selector on the top of the page, it starts in "Off" by default.
  • On the service simulator, type: "Ask hello world".

You should get a valid JSON in reply:

After that you can try other utterances like:

get high tide
when is the next highest water for virginia beach
what cities are supported

We can also use the bst utter command to test locally instead of using the Service Simulator. In order to do this, you need to tell Flask-Ask to not verify the request signatures (which it does by default).

After line 55 (opens new window) of tidepooler.py, insert the following line:

app.config['ASK_VERIFY_REQUESTS'] = False

Please Note: As mentioned in the documentation (opens new window), this should be disabled for production.

Restart your python skill server and from a new terminal (make sure bst proxy is still running) at the root of the project run:

$ bst utter -i speech_assets/IntentSchema.json -s speech_assets/SampleUtterances.txt get high tide

You should see the request and then the response back from tidepooler.py.

You can even test with slots by including your slot value in brackets, for example:

$ bst utter -i speech_assets/IntentSchema.json -s speech_assets/SampleUtterances.txt when is the next highest water for {virginia beach}