@alexa-skill-components/in-skill-purchase
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -6,3 +6,3 @@ { | ||
"com.amazon.alexa.skill.components.inSkillPurchase.cancel.dPNAR", | ||
"com.amazon.alexa.skill.components.inSkillPurchase.cancel.dummy", | ||
"com.amazon.alexa.skill.components.inSkillPurchase.cancel.loader", | ||
"com.amazon.alexa.skill.components.inSkillPurchase.cancel.CancelSpecificProductRequest", | ||
@@ -106,3 +106,3 @@ "com.amazon.alexa.skill.components.inSkillPurchase.cancel.defaultCancelEvent", | ||
"kind": "QualifiedNameDeclaration", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.cancel.dummy", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.cancel.loader", | ||
"type": { | ||
@@ -131,3 +131,3 @@ "kind": "TypeReference", | ||
"name": "com.amazon.alexa.ask.conversations.Path", | ||
"arguments": "../response/prompts/dummy_response_apla/document.json", | ||
"arguments": "../response/prompts/loader_response_apla/document.json", | ||
"type": { | ||
@@ -1030,3 +1030,3 @@ "kind": "TypeReference", | ||
"kind": "NameReference", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.cancel.dummy", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.cancel.loader", | ||
"type": { | ||
@@ -1033,0 +1033,0 @@ "kind": "TypeReference", |
{ | ||
"schema": "https://amazonalexa.com/ask/2020/12/Module", | ||
"exports": [ | ||
"com.amazon.alexa.skill.components.inSkillPurchase.upsell.dummy", | ||
"com.amazon.alexa.skill.components.inSkillPurchase.upsell.loader", | ||
"com.amazon.alexa.skill.components.inSkillPurchase.upsell.sendUpsellDirective", | ||
@@ -11,3 +11,3 @@ "com.amazon.alexa.skill.components.inSkillPurchase.upsell.upsell" | ||
"kind": "QualifiedNameDeclaration", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.upsell.dummy", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.upsell.loader", | ||
"type": { | ||
@@ -36,3 +36,3 @@ "kind": "TypeReference", | ||
"name": "com.amazon.alexa.ask.conversations.Path", | ||
"arguments": "../response/prompts/dummy_response_apla/document.json", | ||
"arguments": "../response/prompts/loader_response_apla/document.json", | ||
"type": { | ||
@@ -176,3 +176,3 @@ "kind": "TypeReference", | ||
"kind": "NameReference", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.upsell.dummy", | ||
"name": "com.amazon.alexa.skill.components.inSkillPurchase.upsell.loader", | ||
"type": { | ||
@@ -179,0 +179,0 @@ "kind": "TypeReference", |
{ | ||
"name": "@alexa-skill-components/in-skill-purchase", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"publisher": "Amazon", | ||
@@ -5,0 +5,0 @@ "license": "AmznSL-1.0", |
272
README.md
@@ -1,87 +0,159 @@ | ||
<p align="center"> | ||
<h1 align="center">In Skill Purchase Component</h1> | ||
</p> | ||
<h1 align= "center"> In-Skill Purchasing Skill Component </h1> | ||
Gather feedback on interactions to help drive skill development. | ||
**Please note**: Alexa Skill Components are being provided as a pre-production alpha | ||
release in Developer Preview with limited support. Our goal is to solicit feedback on our approach and design building towards their broader general availability in the future. While we will make every effort to minimize it, we do not make any backwards compatibility or rapid | ||
turn-around bug-fix promises with this pre-production alpha release. You can [sign | ||
up for the developer preview](https://build.amazonalexadev.com/2022-Skill-Components-Interest.html) here to use these components. | ||
**Please note**: Alexa Skill Components are provided as a pre-production | ||
alpha release in developer preview with limited support. Our goal is to | ||
solicit feedback on our approach and design building towards their | ||
broader general availability in the future. While we will make every | ||
effort to minimize it, we do not make any backwards compatibility or | ||
rapid turn-around bug-fix promises with this pre-production alpha | ||
release. You can [sign up for the developer | ||
preview](https://build.amazonalexadev.com/2022-Skill-Components-Interest.html) | ||
to use these components. | ||
We will be actively making updates to these components and we look forward to mature them with your feedback. So, check back in here to get the latest and greatest version. | ||
Amazon is actively making updates to these components and looks forward | ||
to your feedback. Check back to get the latest version. | ||
[Sign up and join us](https://build.amazonalexadev.com/2022-Skill-Components-Interest.html) in our effort to help you build more engaging Alexa skills faster! | ||
[Sign up to join | ||
us](https://build.amazonalexadev.com/2022-Skill-Components-Interest.html) | ||
in our effort to help you build more engaging Alexa skills faster! | ||
## Table of Contents | ||
Table of Contents | ||
----------------- | ||
* [Introduction](#introduction) | ||
* [When should I use this component?](#when-should-i-use-this-component) | ||
* [Example Interaction](#example-interaction) | ||
* [Getting Started](#getting-started) | ||
* [Reference](#reference) | ||
- [Introduction](https://github.com/alexa/skill-components/tree/main/in-skill-purchase#introduction) | ||
- [When should I use this | ||
component?](https://github.com/alexa/skill-components/tree/main/in-skill-purchase#when-should-i-use-this-component) | ||
- [Example | ||
Interaction](https://github.com/alexa/skill-components/tree/main/in-skill-purchase#example-interaction) | ||
- [Getting | ||
Started](https://github.com/alexa/skill-components/tree/main/in-skill-purchase#getting-started) | ||
- [Reference](https://github.com/alexa/skill-components/tree/main/in-skill-purchase#reference) | ||
## Introduction | ||
Alexa Skill Components encapsulate best customer experience (CX) design practices to reduce your development time. Learn more about Skill Components in the [Skill Components Getting Started guide](../README.md#getting-started). The In-skill Purchasing Reusable Skill Component can be used to add the [in-skill purchasing workflow](https://developer.amazon.com/en-US/docs/alexa/in-skill-purchase/isp-overview.html) into the skill, which lets Alexa Skill developers to sell premium content, such as game features or any other subscription in custom skills. For the current version of the component, it mainly supports payment model of subscriptions which are offers access to premium content or features for a period of time, charged on a recurring basis until the user cancels the subscription. | ||
Introduction | ||
------------ | ||
[In-skill | ||
purchasing](https://developer.amazon.com/en-US/docs/alexa/in-skill-purchase/isp-overview.html) | ||
(ISP) lets you sell premium digital content, such as hints in a trivia | ||
skill or additional lives in custom skills. ISP supports three payment | ||
models: one-time purchases, consumables, and subscriptions. The ISP | ||
skill component lets you add in-skill purchasing workflow to your skill | ||
as a pre-built voice experience. At this time, the component supports | ||
subscriptions only. Subscriptions offer access to premium content or | ||
features for a period of time, charged on a recurring basis until the | ||
user cancels the subscription. | ||
Alexa Skill Components encapsulate best customer experience design | ||
practices to reduce your development time. To learn more about Skill | ||
Components, see Alexa Skill Components Getting Started. | ||
### When should I use this component? | ||
Are you building an app in which you would like the customer to add the in-skill purchasing workflow into the skill, which lets Alexa Skill developers to sell premium content, such as game features or any other subscription in custom skills. Use the pre-built interaction patterns within the In Skill Purchase Component to build out and customize such interactions. | ||
Are you building an app in which you would like the customer to add the | ||
in-skill purchasing workflow into the skill, which lets Alexa Skill | ||
developers to sell premium content, such as game features or any other | ||
subscription in custom skills. Use the pre-built interaction patterns | ||
within the In-Skill Purchase Component to build out and customize such | ||
interactions. | ||
### Example Interaction | ||
This is just a sample interaction of a skill which has 3 in skill purchase products (Value subscription,Premium Subscription,Elite Subscription). | ||
Purchase scenario: | ||
The following interactions show a skill that offers three types of | ||
in-skill products: value subscription, premium subscription, and elite | ||
subscription. | ||
The following example shows a purchase suggestion. | ||
``` | ||
User > What can I buy? | ||
Alexa > With our Value subscription, you can access 45+ mindfull sessions; with our Premium Subscription, you can add on 150+ guided workouts, and with our Elite Subscription, you can set up dedicaed sessions with our certified trainers. Which one would you like to learn more about? | ||
User > Tell me more about Elite Subscription | ||
Alexa > Elite subscription is free for 7 days . Then you’ll be automatically charged $0.99 a month plus tax. Cancel anytime. Check the Alexa app for terms. Should I start your free trial? | ||
User > What can I buy? | ||
Alexa > With our value subscription, you can access 45+ mindful | ||
sessions; with our premium subscription, you can add 150+ guided | ||
workouts, and with our elite subscription, you can set up dedicated | ||
sessions with our certified trainers. Which one would you like to learn | ||
more about? | ||
User > Tell me more about the elite subscription | ||
Alexa > Elite subscription is free for 7 days. Then, you’ll be | ||
charged \$0.99 a month plus tax. Cancel anytime. Check the Alexa app for | ||
terms. Should I start your free trial? | ||
User > Yes | ||
Alexa > Great! You're signed up. | ||
``` | ||
Cancel scenario: | ||
``` | ||
User > Cancel Elite subscription | ||
Alexa > Okay! As a reminder, with elite subscription you can set up dedicated sessions with our certified trainers. Are you sure you want to cancel your subscription? | ||
User > Yes | ||
Alexa > Okay, I've canceled elite subscription, and you'll no longer be charged. You can continue to use it until the end of this subscription period. | ||
The following example shows a cancellation. | ||
``` | ||
User > Cancel elite subscription | ||
## Getting Started | ||
Alexa > Okay! As a reminder, with elite subscription you can set up | ||
dedicated sessions with our certified trainers. Are you sure you want to | ||
cancel your subscription? | ||
### 1. Familiarize yourself with Alexa Skill Components | ||
User > Yes | ||
Read [Skill Components Getting Started guide](../README.md#getting-started) | ||
Alexa > Okay, I've canceled elite subscription, and you'll no longer | ||
be charged. You can continue to use it until the end of this | ||
subscription period. | ||
For those unfamiliar with skill development, the [flight search example skill tutorial](https://developer.amazon.com/en-US/docs/alexa/workshops/acdl-flightsearch-tutorial/get-started/index.html) is a good starting place. | ||
``` | ||
### 2. Adding in-skill purchase products to your existing skill. | ||
Getting Started | ||
--------------- | ||
1. Any existing ACDL Alexa Skill or [Get Started with ACDL Alexa Skill](https://developer.amazon.com/en-US/docs/alexa/conversations/acdl-get-started.html). | ||
2. [Create and Manage In-Skill Products](https://developer.amazon.com/en-US/docs/alexa/in-skill-purchase/create-isp-dev-console.html) | ||
Note: For this version we only support in-skill purchase product of type subscription | ||
### To get started with the ISP skill component, complete the following steps. | ||
### 3. Install component in your skill | ||
### Familiarize yourself with Alexa Skill Components. | ||
Note that if a `package.json` file does not already exist in the skill's root directory, then one can be created with: | ||
Read the [Skill Components Getting Started | ||
guide](https://github.com/alexa/skill-components/blob/main/README.md#getting-started). | ||
If you're unfamiliar with skill development, the [flight search example | ||
skill | ||
tutorial](https://developer.amazon.com/en-US/docs/alexa/workshops/acdl-flightsearch-tutorial/get-started/index.html) | ||
is a good starting place. | ||
### Add in-skill purchase products to your existing skill. | ||
a. Make sure that you have an existing ACDL Alexa Skill or [Get Started | ||
with ACDL Alexa | ||
Skill](https://developer.amazon.com/en-US/docs/alexa/conversations/acdl-get-started.html) | ||
b. [Create and Manage In-Skill | ||
Products](https://developer.amazon.com/en-US/docs/alexa/in-skill-purchase/create-isp-dev-console.html) | ||
**Note**: For this version Amazon supports the subscription payment model only. | ||
### Install the ISP skill component in your skill. | ||
Make sure that the package.json file exists in the skill's root | ||
directory. You can create a package.json file with the following | ||
command: | ||
``` | ||
npm init | ||
``` | ||
Install the component either from public release or a local build of the component: | ||
You can install the component from the public release or a local build | ||
of the component. | ||
**Public Release** | ||
In your skill's root directory, install using npm: | ||
1. In your skill's root directory, install using npm. | ||
``` | ||
npm install --save @alexa-skill-components/in-skill-purchase | ||
npm install | ||
``` | ||
Also install the component as a dependency in your API code (lambda): | ||
2. Install the component as a dependency in your API code (AWS | ||
Lambda function). | ||
``` | ||
npm install --save @alexa-skill-components/in-skill-purchase | ||
npm install | ||
``` | ||
@@ -91,3 +163,5 @@ | ||
In a seperate directory from your skill, build component from source: | ||
1. In a separate directory from your skill, build the component | ||
from source. | ||
``` | ||
@@ -98,22 +172,31 @@ git clone git@github.com:alexa/skill-components.git | ||
npm run clean-build | ||
``` | ||
then, in your skill's root directory, use npm to install the local build: | ||
2. In your skill's root directory, use npm to install the local build. | ||
``` | ||
npm install --save "<path>/skill-components/in-skill-purchase" | ||
npm install --save "<path>/skill-components/in-skill-purchase" | ||
npm install | ||
``` | ||
Also install the component as a dependency in your API code (lambda): | ||
3. Install the component as a dependency in your API code (AWS Lambda | ||
function): | ||
``` | ||
npm install --save "<path>/skill-components/in-skill-purchase" | ||
npm install --save "<path>/skill-components/in-skill-purchase" | ||
npm install | ||
``` | ||
### 4. Call reusable dialog | ||
### Call the reusable dialog | ||
*1.1. Invoke purchase RD in your existing ACDL dialog from where you want to direct user to choose a product or start the purchase flow with a product specified.* | ||
1\. Invoke the purchase suggestion dialog in your existing ACDL dialog. | ||
Choose where you want to direct the user to select a product or start | ||
the purchase flow with a product specified. To do this, import the ISP | ||
component, and then call | ||
[buySpecificProduct](https://github.com/alexa/skill-components/blob/main/in-skill-purchase/docs/REFERENCE.md#buySpecificProduct). | ||
The following example code shows the purchase dialog invocation. | ||
Import and call [`buySpecificProduct`](./docs/REFERENCE.md#buySpecificProduct) | ||
ACDL Sample Example consuming In-skill Purchasing Reusable Dialog | ||
``` | ||
@@ -137,6 +220,8 @@ namespace com.example.skill.name | ||
*1.2. Invoke upsell RD in your existing ACDL dialog from where you want to promote a product to user.* | ||
2\. Invoke the upsell reusable dialog in your existing ACDL dialog at the | ||
point where you want to promote a product to user. To do this, import | ||
the ISP component, and then call | ||
[upsell](https://github.com/alexa/skill-components/blob/main/in-skill-purchase/docs/REFERENCE.md#upsell) | ||
. The following example code shows the upsell dialog invocation. | ||
Import and call [`upsell`](./docs/REFERENCE.md#upsell) | ||
ACDL Sample Example consuming In-skill Purchasing Reusable Dialog | ||
``` | ||
@@ -158,8 +243,11 @@ namespace com.example.skill.name | ||
} | ||
``` | ||
*1.3. Invoke cancel RD in your existing ACDL dialog from where you want to allow user to cancel the purchase of any product.* | ||
3\. Invoke the cancel reusable dialog in your existing ACDL dialog at the | ||
point where you want to allow the user to cancel the purchase of any | ||
product. To do this, import the ISP component, and then call | ||
[cancelPurchase](https://github.com/alexa/skill-components/blob/main/in-skill-purchase/docs/REFERENCE.md#cancelPurchase). | ||
The following example code shows the cancel dialog invocation. | ||
Import and call [`cancelPurchase`](./docs/REFERENCE.md#cancelPurchase) | ||
ACDL Sample Example consuming In-skill Purchasing Reusable Dialog | ||
``` | ||
@@ -183,6 +271,9 @@ namespace com.example.skill.name | ||
*1.4. Invoke resume RD in your existing ACDL dialog from where you want to resume the skill after purchase/cancel/upsell is finished.* | ||
4\. Invoke the resume reusable dialog in your existing ACDL dialog at the | ||
point where you want to resume the skill after the purchase, cancel, and | ||
upsell dialogs complete. To do this, import the ISP component, and then | ||
call | ||
[resumeAfterPurchase](https://github.com/alexa/skill-components/blob/main/in-skill-purchase/docs/REFERENCE.md#resumeAfterPurchase). | ||
The following example code shows the resume dialog invocation. | ||
Import and call [`resumeAfterPurchase`](./docs/REFERENCE.md#resumeAfterPurchase) | ||
ACDL Sample Example consuming In-skill Purchasing Reusable Dialog | ||
``` | ||
@@ -208,7 +299,7 @@ namespace com.example.skill.name | ||
### 5. Setup API Handlers | ||
### Setup API Handlers | ||
**1. Register API handlers** | ||
Import the API handlers into your main Lambda index file. | ||
Import the API handlers into your main Lambda index.js file. | ||
@@ -242,6 +333,8 @@ **TypeScript** | ||
### 6. Compile and deploy your Skill | ||
### Compile and deploy your Skill. | ||
Build your skill as one would normally; the component's dialogs samples and API handlers (that were integrated into | ||
the skill) will be built along-side your skill's own custom dialog samples and handlers. | ||
Build your skill as normal. The component's dialogs samples and API | ||
handlers that you integrated into the skill are built along-side your | ||
skill's own custom dialog samples and handlers. To build and deploy your | ||
skill, run the following command: | ||
@@ -252,30 +345,51 @@ ``` | ||
Note that a Alexa Conversations skill deployment can take 20-40 minutes to complete. | ||
**Note**: An Alexa Conversations skill deployment can take 20-40 minutes to | ||
complete. | ||
### 7. Test your Skill. | ||
To do so via CLI, you can run the following: | ||
### Test your Skill. | ||
To simulate your Alexa device, you can test your skill in the Alexa | ||
Developer Console on the **Test** tab Or, you can test your skill by | ||
using the Alexa Skills Kit CLI. | ||
To test your skill by using the CLI, run the following command: | ||
``` | ||
askx dialog -s <YOUR_SKILL_ID> -l en-US -g development | ||
``` | ||
Or you can use the Developer Console via the "Test" tab to simulate apart from your Alexa device. | ||
### 8. Iterate | ||
### Iterate on the reusable dialogs | ||
After testing the default behavior of the component, look into the [reference doc](./docs/REFERENCE.md) to see possible customizations to suit your use case. | ||
After you test the default behavior of the component, you can customize | ||
the ISP component. For details about customizations, see [ACDL Reusable | ||
Dialogs | ||
reference](https://github.com/alexa/skill-components/blob/main/in-skill-purchase/docs/REFERENCE.md). | ||
To deploy any changes, run compile and deploy again: | ||
To compile and deploy changes, run the following command: | ||
``` | ||
askx compile && askx deploy | ||
``` | ||
## Reference | ||
Details on all dialogs can be found in the [Reference doc](./docs/REFERENCE.md) | ||
Reference | ||
--------- | ||
## Got Feedback? | ||
Details on all dialogs can be found in the [Reference | ||
doc](https://github.com/alexa/skill-components/blob/main/in-skill-purchase/docs/REFERENCE.md) | ||
We are always improving our experiences for you and welcome your candid feedback. Connect with us on [here](https://github.com/alexa/skill-components#support) | ||
Got Feedback? | ||
------------- | ||
Amazon welcomes your feedback. Connect with us on | ||
[here](https://github.com/alexa/skill-components#support). | ||
License | ||
------- | ||
Copyright 2022 Amazon.com, Inc., or its affiliates. All rights reserved. | ||
You may not use this file except in compliance with the terms and | ||
conditions set forth in the accompanying [LICENSE](https://github.com/alexa/skill-components/blob/main/LICENSE) file. THESE MATERIALS | ||
ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY DISCLAIMS, WITH | ||
RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS, IMPLIED, OR | ||
STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
@@ -13,2 +13,8 @@ { | ||
{ | ||
"when": "${payload.response.inSkillProductList.length == 0}", | ||
"type": "Speech", | ||
"contentType": "SSML", | ||
"content": "No products available for purchase" | ||
}, | ||
{ | ||
"when": "${payload.response.inSkillProductList.length == 1}", | ||
@@ -15,0 +21,0 @@ "type": "Speech", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308103
6086
388