Giter VIP home page Giter VIP logo

skill-sample-nodejs-fact-in-skill-purchases's Introduction

Regions: 🇯🇵

Build An Alexa Skill with In-Skill Purchases - Premium Fact

Adding premium content to your skill is a way for you to monetize your skill. This sample skill has taken the basic fact skill and has added new categories as premium content. This premium content is accessed through either a subscription or the one-time purchase of a given category. This guide walks through the setup of this skill, including the creation of the in-skill products.

Skill Architecture

Each skill consists of two basic parts, a front end and a back end.

  1. The front end is the voice interface, or VUI. The voice interface is configured through the voice interaction model.
  2. The back end is where the logic of your skill resides.

Three Options for Skill Setup

There are a number of different ways for you to setup your skill, depending on your experience and what tools you have available - Alexa Hosted, AWS Hosted, ASK CLI. For this Fact Skill, we will be using the Alexa Hosted option. If you'd like to use the AWS Hosted, or ASK CLI methods, you can check out the instructions here for the Sample Fact skill - AWS Hosted Instructions | ASK CLI instructions

Alexa Hosted

With an Alexa-hosted skill, you can build, edit, and publish a skill without leaving the developer console. The skill includes a code editor for managing and deploying the backend code for your skill. For details on what the Alexa-Hosted skills service provides, open this page in a new tab.

To Get Started using the Alexa Developer Console, click the button below:

Get Started

Additional Resources

Community

Tutorials & Guides

  • Voice Design Guide - A great resource for learning conversational and voice user interface design.
  • Codecademy: Learn Alexa - Learn how to build an Alexa Skill from within your browser with this beginner friendly tutorial on Codecademy!

Documentation

License Summary

This sample code is made available under a modified MIT license. See the LICENSE file. -->

skill-sample-nodejs-fact-in-skill-purchases's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skill-sample-nodejs-fact-in-skill-purchases's Issues

skill.json would not be approved for certification

The example phases are

      "examplePhrases": [
        "Alexa open Premium Facts Sample",
        "tell me a science fact",
        "buy an all access subscription"

but 1.Skills that allow customers to make in-skill purchases may not contain a call to action or inform the customer about how to purchase additional content within the skill example phrases. For example - “buy an all access subscription.”

Please remove the call to action from your skill’s metadata

The example should not give confusing information that would fail certification

SyntaxError when copying code

When uploading my lambda and testing it on the AWS console, I get the following. This occurs after I run ask deploy

{
  "errorMessage": "Unexpected token )",
  "errorType": "SyntaxError",
  "stackTrace": [
    "    ^",
    "SyntaxError: Unexpected token )",
    "createScript (vm.js:56:10)",
    "Object.runInThisContext (vm.js:97:10)",
    "Module._compile (module.js:542:28)",
    "Object.Module._extensions..js (module.js:579:10)",
    "Module.load (module.js:487:32)",
    "tryModuleLoad (module.js:446:12)",
    "Function.Module._load (module.js:438:3)",
    "Module.require (module.js:497:17)",
    "require (internal/module.js:20:19)"
  ]
}

I'm using Node.js 6.10 for AWS (and I've tried 4.3 and 8.10 with no luck). Locally, I'm using node v8.9.4 and npm version 6.1.0.

Syntax Error

Hello all,

I followed the tutorial here and tried to recreate the skill but I am getting a syntax error.
I am not sure where I am getting this error from.

Syntax error in module 'index': SyntaxError
);
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)

is what is being shown in CloudWatch.

I've looked through js and json files I have edited but still running into the same issue. Can anyone help me?

Unable to import module 'index': Error

Hi, I followed the instructions exactly, but I'm getting the following error in the cloud log. What does it mean and how can I correct it?

Unable to import module 'index': Error
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/var/task/index.js:6:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

In-skill products fail to obtain Product IDs, Deployment Fails

Ask deploy is not working despite verifying everything is correct several times as well as trying to deploy it several times. Please help! Thank you!

`Profile for the deployment: [default]
In-skill product deployment failed.
[Error]: No skill Id found in the current skill project. Use "ask deploy" to deploy in-skill product with skill if the skill has not been deployed yet.
Redacted:Premium_Facts_Live Redacted$ ask deploy -pl --profile IAM
Skill Id: redacted
Skill deployment finished.
Model deployment finished.
Lambda deployment finished.
Lambda function(s) updated:
[URI] redacted:ask-custom-Premium_Facts_Live-IAM
No in-skill product to be deployed.

release 1.0.1 does NOT work because nodejs8.10 is no longer supported

I followed this Alexa tutorial article.
https://developer.amazon.com/blogs/alexa/post/ab0901f8-5b18-483c-91ea-5d2347e117ca/how-to-set-up-alexa-account-linking-with-amazon-cognito-user-pools-to-create-a-personalized-customer-experience

Under "Create AWS Lambda Function",
I followed the link below to deploy a lambda function.
https://us-west-2.console.aws.amazon.com/lambda/home?region=us-west-2#/create/app?applicationId=arn:aws:serverlessrepo:us-east-1:173334852312:applications/alexa-skills-kit-nodejs-premium-facts-skill

Cloudformation showed Error:
CREATE_FAILED
The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException;

Random fact given across purchased & non-purchased ISPs

I've setup this template and when I invoke a random fact, Alexa gives a fact across all 3 categories (science, history, space) without having purchased any packs. How can I separate my index.js file to only give random "free" facts while separating the ones that still need to be purchased?

Alexa keep on saying "Good news! You already own that."

Hi All!
I have finally built a workable ISP. However, each time I call the premium intent, alexa keeps on saying "Alexa keep on saying "Good news! You already own that." along with the output I've given her.
image
Is there a way to change/remove the default line? if not, how should I structure my func in a way that once its called it doesn't produce that default line?
My premium intent's class:


class GoogleIntentHandler(AbstractRequestHandler):
    def can_handle(self, handler_input):
        return ask_utils.is_intent_name("GoogleIntent")(handler_input)
    def handle(self, handler_input):
        in_skill_response=in_skill_product_response(handler_input)
        if in_skill_response:
            Output = handler_input.response_builder.speak("Calendar event created")
            subscription=[ l and Output for l in in_skill_response.in_skill_products if l.reference_name == "GoogleTarget"]
            if is_entitled(subscription):
                return None
            else:
                return handler_input.response_builder.add_directive(
                    SendRequestDirective(
                        name="Buy",
                        payload= {
                            "InSkillProduct": {
                                "productId": "amzn1.adg.product.0caccc4b-fa88-4685-a...6b1ffa",
                                }
                        },
                        token= "correlationToken")
                    ).response                

I know this is a node.js community. I am sure you would be able to get the idea of my class regardless. If you even provide me an answer or explanation written in node I would be fine, as working with Alexa has made it easier for me to translate node.

Error when attempting to purchase something owned

Just received feedback about my submission:

  1. When invoking the skill with one or more of the intent(s) or sample utterances, the skill’s response is irrelevant to the request or contains an error.

Issue: [BuyIntent] Intent

Steps to Reproduce:

(After purchasing the entitlement)

User: “Alexa, open presidential wisdom”
Skill: “Welcome to Presidential Wisdom. You currently own The Thomas Jefferson Quote Pack, The Abraham Lincoln Quote Pack, The George Washington Quote Pack, The Theodore Roosevelt Quote Pack. For which Presidents you can add, say, 'Who can i add?'. To get started, you can say, 'Tell me a quote' or you can ask for a president's last name, like, 'Tell me a Washington quote.'”
User: “buy Washington pack”
Skill: “Good news, you already have The George Washington Quote Pack. There was an error handling your purchase request. Please try again or contact us for help.”

What should I change in order to fix this? Something around here?

    console.log(`Connections.Response indicated failure. error: ${handlerInput.requestEnvelope.request.status.message}`);



    return handlerInput.responseBuilder

      .speak('There was an error handling your purchase request. Please try again or contact us for help.')

      .getResponse();

  },

};

ProductDetailIntent would not pass certification

The skill does not provide sufficient information regarding the functionality of the in-skill subscription item(s).

Intent: ProductDetailIntent

Steps to reproduce:

User: “Alexa, open premium fun facts”
Skill: “Welcome to Premium Fun Facts. To hear a random fact you can say 'Tell me a fact', or to hear about the premium categories for purchase, say 'What can I buy'. For help, say , 'Help me'... So, What can I help you with?”
User: “what can i buy”
Skill: “Products available for purchase at this time are Space Pack, History Pack, Science Pack, All Access. To learn more about a product, say 'Tell me more about' followed by the product name. If you are ready to buy say 'Buy' followed by the product name. So what can I help you with?”
User: “tell me more about all access”
Skill: “I don't think we have a product by that name. Can you try again?”

Please note that the skill should provide information about "all access".

Missing file: [ID] undefined [FILE] isps/entitlement/Entitlement_Template.json

I followed the tutorial closely but I'm getting the following error:

Skill deployment finished.
Model deployment finished.
Lambda deployment finished.
Lambda function(s) updated:
[URI] arn:aws:lambda:us-east-1:090626355864:function:ask-custom-Premium_Facts_Sample-default

Error(s) found in the deploy setting for the following in-skill product(s):
(Please restore the missing file or modify skill configuration file .ask/config to fix the deploy setting)

Missing file: [ID] undefined [FILE] isps/entitlement/Entitlement_Template.json
Missing file: [ID] undefined [FILE] isps/subscription/Subscription_Template.json

In-skill product deployment finished.
In-skill product(s) updated:
[ID] amzn1.adg.product.400c49d1-19be-4606-b3a4-8195736d78ea [FILE] isps/entitlement/science_pack.json
[ID] amzn1.adg.product.64b0ba8e-08a5-4b06-8a18-a3a281241118 [FILE] isps/entitlement/space_pack.json
[ID] amzn1.adg.product.e57695d1-deec-4344-b95f-207f226cf667 [FILE] isps/entitlement/history_pack.json
[ID] amzn1.adg.product.c58ee911-772b-415e-91a8-65b5ea7e2217 [FILE] isps/subscription/all_access.json
Your skill is now deployed and enabled in the development stage.
Try invoking the skill by saying “Alexa, open {your_skill_invocation_name}” or simulate an invocation via the ask simulate command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.