Just say “Alexa ask Meraki why is the network slow?” Amazon Alexa can use Meraki’s Dashboard API to control and answer questions all hands-free. Ask Alexa for the status of the network, monitor the traffic usage, and block fantasy football websites. 

Source Code

Prerequisites

You will need:

  1. Amazon Echo device or Alexa package running on a device (like a Raspberry Pi), or the Amazon Shopping mobile app on Android/iPhone (pictured below)

2. Account on developer.amazon.com

3. Account on aws.amazon.com

Getting Started

  1. Login to developer.amazon.com, where your custom skill is created and where you define the things you can say to invoke your custom skill. The name of the skill is “Meraki”, so every interaction will start with “Alexa, ask Meraki …”  Click the Alexa section of the menu:

Copy contents of Intent Schema into Interaction Model:

In the bottom half of the same Interaction Model page, copy contents from Sample Utterances.  These can be modified to phrases that you choose, and be sure to modify your name as well for some of the functions to demo!

A unique endpoint (ARN: Amazon Resource Name) will be created for your Lambda function (shown in the upper right of the AWS console) which you will enter into the box below (the following slides will cover how to obtain this value, some return here afterward).

Login to your AWS account, which will be used for access to Lambda where the code associated with your custom skill will run. You may have to set up payment info but can use the Lambda free tier, which is under 1M requests per month.  Lambda is only available in US East (N. Virginia) currently. Be sure to select that region to see the Lambda option.

Name the Lambda function, and choose “Create a custom role”:

Select the following for role summary, then Allow:

Increase timeout to handle longer scripts & processes (recommended at least 15 seconds as the bare minimum, and can be even longer like 30 or more), and save:

Download, modify and then re-upload Archive.zip into the “Function code” section; don’t forget to save!

The logic behind Alexa skill is in lambda_function.py (no need to edit, unless you want to add your own functions later)

Please include and review meraki_info.py, making needed edits

This deployment package created from the “advanced scenario” instructions; if you want to recreate on macOS:
1. add the mentioned setup.cfg file to project directory
2. navigate to that project directory, and then install following modules
3. pip3 install requests -t /path/to/project-dir
4. pip3 install meraki -t /path/to/project-dir [–upgrade]

After you have made the necessary changes to meraki_info.py, zip the entire folder’s contents (not the folder itself). For example, similar to this screenshot on macOS:

Upload the ZIP file, select “Python 3.6” for runtime, change Handler to “lambda_function.lambda_handler” and then save:

For the Designer section at the top, add the “Alexa Skills Kit” as a trigger:

Once your function is created and selected, you should see the Amazon Resource Name located in the upper right of the AWS console like the example below:

This is the value you will use for the Lambda ARN back on the “Point to Your Lambda Function” slide

Enable testing of the skill and enable it on your Echo device via the Alexa app or website. Make sure that the language selected here (“English (U.S.)” in the screenshot, for example) is the same as configured for your Echo on the mobile app or website.

Testing Text

To run tests without using your actual Alexa-capable device, use the test section to type in “who are you” or “what’s on the roadmap”, and verify the response.

Testing Voice

The voice simulator tool on the test page is helpful for tuning your speech output. Adding a space, comma, etc. can help Alexa read things back clearly and you can format your speech output based on your preference.

Alexa ask Meraki…

  1. Network usage and top client: “Ask Meraki why the internet is so slow?
  2. Block the particular user’s client devices: “Ask Meraki to block <User> from <Group Policy Name>” (substitute with your name and group policy, as in the meraki_info.py file)
  3. Some of the other commands:
  • ask Meraki to get network status
  • ask Meraki to check license expiration
  • ask Meraki to query device status
  • ask Meraki to get client devices

4. Create your own by adding the intent, utterances, and function into lambda_function.py!

Check out the demo video!

Attachments