Skip to main content

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.

Metadata

Release files for ask-smapi-sdk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ask-smapi-sdk 1.0.0
File Size Uploaded
ask-smapi-sdk-1.0.0.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ask-smapi-sdk 1.0.0
File Interpreter ABI Platform
ask_smapi_sdk-1.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 29.4 kB

Release files / ask-smapi-sdk-1.0.0.tar.gz

Download URL ask-smapi-sdk-1.0.0.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ece980b0967fecbe6851f37517cac2288303ed952c9ed1f179bc6ee05b318560
BLAKE2b-256 checksum
How to use checksums
2931fb5191898a0f48662c10607f0adfa782ba6c25632ab8f2f8067f37db6339
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ask_smapi_sdk-1.0.0-py2.py3-none-any.whl

Download URL ask_smapi_sdk-1.0.0-py2.py3-none-any.whl
Size 11.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6c9d28c0ae6e8c50efc45219cce47a29c887c0423b705b1ab2c36f8be57b36f0
BLAKE2b-256 checksum
How to use checksums
2ac9fe6a5f80e112f059acef52c5bdbdc7788902c16ea6b2bf7a40343dabf782
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page