npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ask-smapi-sdk

v1.3.0

Published

Core package for SMAPI Skills Kit SDK

Downloads

4,378

Readme

ASK SMAPI SDK - Alexa Skills Management API Node.js Library

ask-smapi-sdk is a library for Alexa Skills Kit's Skill Management APIs (SMAPI). Learn more about SMAPI by reviewing the SMAPI documentation.

Getting Started

Install NPM and the ASK CLI

  1. Install NPM using the instructions provided here. 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.
  2. Install ask-cli.

Generate LWA (Login with Amazon) Keys

  1. Create a new security profile for your Amazon Developer account by following the instructions provided here. This will generate Client ID and Client Secret keys.
  2. Using the ASK CLI, run: ask util generate-lwa-tokens --client-id <Client ID> --client-confirmation <Client Secrect>. Replace the <Client ID> and <Client Secrect> with 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"
}

Usage Examples

Install ASK SMAPI SDK from NPM

$ npm install ask-smapi-sdk

Configure SMAPI Client

Using the Client ID, Client Secret and Refresh Token retrieved in the previous step to configure a new SMAPI client:

For Node.js

const Alexa = require('ask-smapi-sdk');

// specify the refreshTokenConfig with clientId, clientSecret and refreshToken generated in the previous step
const refreshTokenConfig = {
    clientId,
    clientSecret, 
    refreshToken
}
const smapiClient = new Alexa.StandardSmapiClientBuilder()
    .withRefreshTokenConfig(refreshTokenConfig)
    .client();

For typescript

import * as Alexa from 'ask-smapi-sdk';

// specify the refreshTokenConfig with clientId, clientSecret and refreshToken generated in the previous step
const refreshTokenConfig : Alexa.RefreshTokenConfig = {
    clientId,
    clientSecret, 
    refreshToken
}
const smapiClient = new Alexa.StandardSmapiClientBuilder()
    .withRefreshTokenConfig(refreshTokenConfig)
    .client();

List Skills

# To only retrieve response body
smapiClient.listSkillsForVendorV1(vendorId)
    .then((response) => {
        console.log(JSON.stringify(response));
    })
    .catch((err) => {
        console.log(err.message);
        console.log(JSON.stringify(err.response));
    });
    
# To include response header and status code
smapiClient.callListSkillsForVendorV1(vendorId)
    .then((response) => {
        console.log(response.header);
    })
    .catch((err) => {
        console.log(err.message);
        console.log(JSON.stringify(err.response));
    });

Get Skill Manifest

smapiClient.getSkillManifestV1(skillId, stage)
    .then((response) => {
        console.log(JSON.stringify(response));
    })
    .catch((err) => {
        console.log(err.message);
        console.log(JSON.stringify(err.response));
    });

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

Documentatiion

Opening Issues

For bug reports, feature requests and questions, we would like to hear about it. Search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of the SDK, Node.js or browser environment and OS you’re using. Please include a stack trace and reduced repro case when appropriate, too.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.