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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file ask-smapi-sdk-1.0.0.tar.gz.

File metadata

  • Download URL: ask-smapi-sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.3

File hashes

Hashes for ask-smapi-sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ece980b0967fecbe6851f37517cac2288303ed952c9ed1f179bc6ee05b318560
MD5 d5ea2607d5cdf7d03b223fb01b35629f
BLAKE2b-256 2931fb5191898a0f48662c10607f0adfa782ba6c25632ab8f2f8067f37db6339

See more details on using hashes here.

File details

Details for the file ask_smapi_sdk-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ask_smapi_sdk-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.3

File hashes

Hashes for ask_smapi_sdk-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6c9d28c0ae6e8c50efc45219cce47a29c887c0423b705b1ab2c36f8be57b36f0
MD5 216f44bff17a6d8d679495711878b9eb
BLAKE2b-256 2ac9fe6a5f80e112f059acef52c5bdbdc7788902c16ea6b2bf7a40343dabf782

See more details on using hashes here.

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