{"componentChunkName":"component---src-templates-docs-js","path":"/training/workshops/sample4","result":{"data":{"site":{"siteMetadata":{"title":"Dabble Lab","docsLocation":"https://github.com/dabblelab/dabblelab-documentation-site","docsLocationType":"github","editable":true}},"mdx":{"fields":{"id":"142aedbc-f0d0-51f0-b47c-b41ab3d98aef","title":"Alexa Skills Management API","slug":"/training/workshops/sample4"},"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Alexa Skills Management API\",\n  \"order\": 3\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"section\", null, mdx(\"h1\", {\n    parentName: \"section\"\n  }, \"Alexa Skills Management API (SMAPI) SDK Demo for Node.js\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"This demonstration shows how to set up a Node.js project with the Alexa Skills Management API SDK and run some sample API calls to list skills for a vendor ID or get analytics data with the \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://developer.amazon.com/en-US/docs/alexa/smapi/metrics-api.html/\"\n  }), \"Alexa Skill Metrics API\"), \". \")), mdx(\"section\", null, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Prerequisites / Dependencies\"), mdx(\"ul\", {\n    parentName: \"section\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Node.js and NPM (\", mdx(\"a\", _extends({\n    parentName: \"li\"\n  }, {\n    \"href\": \"https://nodejs.com\"\n  }), \"https://nodejs.com\"), \")\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"An Amazon Developer Account (\", mdx(\"a\", _extends({\n    parentName: \"li\"\n  }, {\n    \"href\": \"https://developer.amazon.com\"\n  }), \"https://developer.amazon.com\"), \")\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The ASK CLI (\", mdx(\"a\", _extends({\n    parentName: \"li\"\n  }, {\n    \"href\": \"https://www.npmjs.com/package/ask-cli\"\n  }), \"https://www.npmjs.com/package/ask-cli\"), \")\"))), mdx(\"section\", null, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Setup\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"After you've set up the prerequisites, you'll need to get your authentication information. This is comprised of three steps.\")), mdx(\"section\", null, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Install the Node modules\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Run \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"npm install\"), \" from the command line in the same directory with the demo files.\")), mdx(\"section\", null, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Register a Login with Amazon Security Profile for a Web App\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Make sure you're logged into developer.amazon.com with the same account you use for developing Alexa Skills.\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Follow the instructions here: \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://developer.amazon.com/docs/login-with-amazon/register-web.html#create-a-new-security-profile\"\n  }), \"https://developer.amazon.com/docs/login-with-amazon/register-web.html#create-a-new-security-profile\")), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"You'll need the client ID and secret key from the profile. Add them to the tokens.js file. You can copy and paste them from there in the next step. \")), mdx(\"section\", null, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Get an access token for the API\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Using the ASK CLI, run: \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"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:\"), mdx(\"pre\", {\n    parentName: \"section\"\n  }, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-javascript\"\n  }), \"{\\n  \\\"access_token\\\": \\\"ACCESS_TOKEN\\\",\\n  \\\"refresh_token\\\": \\\"REFRESH_TOKEN\\\",\\n  \\\"token_type\\\": \\\"bearer\\\",\\n  \\\"expires_in\\\": 3600,\\n  \\\"expires_at\\\": \\\"2019-11-19T20:25:06.584Z\\\"\\n}\\n\")), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Add that information to your tokens.js file for easy access.\")), mdx(\"section\", null, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Running the Demos\")), mdx(\"section\", null, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"List your Alexa skills for the account\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"Go to \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://developer.amazon.com/mycid.html\"\n  }), \"https://developer.amazon.com/mycid.html\"), \" to get your VendorID. Add it to your tokens.js file.\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"From the command line, run \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"node listSkills.js\"), \". It will output a JSON list of your skills.\")), mdx(\"section\", null, mdx(\"h3\", {\n    parentName: \"section\"\n  }, \"Get metrics data\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"You'll need the skill ID from one of your skills. This can be found in the Skills Developer Console. Under each skill in your skill list, there's a small link to view the skill ID.\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"The \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://developer.amazon.com/en-US/docs/alexa/smapi/metrics-api.html/\"\n  }), \"Alexa Metrics API documentation\"), \" explains the different values you can (or must) use in this API call.\")), mdx(\"section\", null, mdx(\"h2\", {\n    parentName: \"section\"\n  }, \"Resources\"), mdx(\"p\", {\n    parentName: \"section\"\n  }, \"SMAPI SDK: \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/tree/2.0.x/ask-smapi-sdk\"\n  }), \"https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/tree/2.0.x/ask-smapi-sdk\"), \"\\nMetrics API: \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://developer.amazon.com/en-US/docs/alexa/smapi/metrics-api.html\"\n  }), \"https://developer.amazon.com/en-US/docs/alexa/smapi/metrics-api.html\"))));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#alexa-skills-management-api-smapi-sdk-demo-for-nodejs","title":"Alexa Skills Management API (SMAPI) SDK Demo for Node.js","items":[{"url":"#prerequisites--dependencies","title":"Prerequisites / Dependencies"},{"url":"#setup","title":"Setup","items":[{"url":"#install-the-node-modules","title":"Install the Node modules"},{"url":"#register-a-login-with-amazon-security-profile-for-a-web-app","title":"Register a Login with Amazon Security Profile for a Web App"},{"url":"#get-an-access-token-for-the-api","title":"Get an access token for the API"}]},{"url":"#running-the-demos","title":"Running the Demos","items":[{"url":"#list-your-alexa-skills-for-the-account","title":"List your Alexa skills for the account"},{"url":"#get-metrics-data","title":"Get metrics data"}]},{"url":"#resources","title":"Resources"}]}]},"timeToRead":1,"parent":{"__typename":"File","relativePath":"training/workshops/sample4.md","fields":{"gitLogLatestAuthorName":"Steven Tingiris","gitLogLatestAuthorEmail":"steve@dabblelab.com","gitLogLatestDate":"a day ago"}},"frontmatter":{"metaTitle":null,"showMetadata":null,"editable":null,"showPreviousNext":null,"showToc":null}},"gitBranch":{"name":"13c9979"},"gitCommit":{"hash":"13c9979ef74a5bc3bfd9b8fc61bafb99ba140d64","date":"2020-11-05 06:24"}},"pageContext":{"id":"142aedbc-f0d0-51f0-b47c-b41ab3d98aef"}},"staticQueryHashes":["12478684","12478684","2882937274","2882937274","353167761","353167761","3812332637","3812332637"]}