Skip to main content

The SMAPI SDK package is the python library for Alexa Skill Management API (SMAPI) which contains operations that allow you to programmatically manage and test Alexa skills and related resources such as interaction models

Project description

ASK SMAPI SDK - Alexa Skills Management API Python Library

ask-smapi-sdk is the Python library package for Alexa Skill Management API (SMAPI). SMAPI is a set of API operations that allow you to programmatically manage and test Alexa skills and related resources such as interaction models. More information on SMAPI can be found at Alexa Developer Documentation.

Quick Start

Install ASK SMAPI SDK

Installation from PyPI

Assuming that you have Python and virtualenv installed, you can install the package and it’s dependencies (ask-smapi-model) from PyPI as follows:

$ virtualenv venv
$ . venv/bin/activate
$ pip install ask-smapi-sdk

Installation from Github

$ git clone https://github.com/alexa/alexa-skills-kit-sdk-for-python.git
$ cd alexa-skills-kit-sdk-for-python/ask-smapi-sdk
$ virtualenv venv
...
$ . venv/bin/activate
$ python setup.py install

Install NPM and the ASK CLI

  • Install NPM using the instructions provided here: get-npm.

  • This is needed to get started with the ASK CLI, which will be used to generate Login with Amazon tokens you will need to access SMAPI.

Assuming that you have npm installed, you can install the package from NPM as follows:

$ npm install ask-cli -g

Generate Login with Amazon Keys

  • Create a new security profile for your Amazon Developer account by following the instructions provided here: Generate LWA Keys.

  • This will generate Client ID and Client Secret keys.

  • Using the ASK CLI, run: ask util generate-lwa-tokens. You will be asked to provide the Client ID and Client Secret keys from the previous step. This will return the following JSON with a Refresh Token:

{
  "access_token": "ACCESS_TOKEN",
  "refresh_token": "REFRESH_TOKEN",
  "token_type": "bearer",
  "expires_in": 3600,
  "expires_at": "2019-11-19T20:25:06.584Z"
}

Configure SMAPI Client

  • Import StandardSmapiBuilder from ask_smapi_sdk.

  • Create an instance of StandardSmapiBuilder passing clientId, clientSecret and refreshToken as parameters.

  • Create a smapiClient instance by invoking client method on builder instance.

  • You can invoke SMAPI method call using the smapi_client instance and passing parameters corresponding to the method signatures.

Usage Examples

For the complete list of functions, please see the ASK SMAPI SDK documentation.

List Skills

from ask_smapi_sdk import StandardSmapiBuilder

smapi_client = StandardSmapiBuilder(client_id='Client ID', client_secret='Client Secret Key', refresh_token='Refresh Token').client()
try:
    result = smapi_client.list_skills_for_vendor_v1(vendor_id='Vemdor ID', full_response=True)
    print("==========================================")
    print(result.headers)
    print(result.body)
    print("==========================================")
except Exception as e:
    print(e.message)

Get Skill Manifest

from ask_smapi_sdk import StandardSmapiBuilder

smapi_client = StandardSmapiBuilder(client_id='Client ID', client_secret='Client Secret Key', refresh_token='Refresh Token').client()
try:
    result = smapi_client.get_skill_manifest_v1(skill_id='SKILL ID', stage='SKILL STAGE')
    print("==========================================")
    print(result)
    print("==========================================")
except Exception as e:
    print(e.message)
Documentation
Got Feedback?
  • We would like to hear about your bugs, feature requests, questions or quick feedback. Please search for the existing issues before opening a new one. It would also be helpful if you follow the templates for issue and pull request creation. Please follow the contributing guidelines

  • Request and vote for Alexa features

CHANGELOG

1.0.0

  • Initial release ask smapi sdk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ask-smapi-sdk-1.0.0.tar.gz (17.6 kB view hashes)

Uploaded Source

Built Distribution

ask_smapi_sdk-1.0.0-py2.py3-none-any.whl (11.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page