question

NewTimes avatar image
NewTimes asked

Upsell not working

Hello, I'm trying to implement upsells to my Alexa App. If I replace "Upsell" with "Buy" it works perfectly fine, so it should with upsell too or not?
Skill id: amzn1.ask.skill.2763bc13-520e-455f-8394-a734e7c03c4a

function buyCategoryUpsell(handlerInput, categories, inSkillProduct) {
    const ms = handlerInput.serviceClientFactory.getMonetizationServiceClient();

    return ms.getInSkillProducts(handlerInput.requestEnvelope.request.locale).then((res) => {
        const category = res.inSkillProducts.filter(cat => cat.referenceName === categories);

        if (category.length > 0 && category[0].purchasable === 'PURCHASABLE') {
            return handlerInput.responseBuilder
                .addDirective({
                    type: "Connections.SendRequest",
                    name: "Upsell",
                    payload: {
                        InSkillProduct: {
                            productId: inSkillProduct,
                        },
                        upsellMessage: "More info?",
                    },
                    token: "correlationToken",
                })
                .getResponse();
        }
        return handlerInput.responseBuilder
            .speak('Cant buy')
            .getResponse();
    })
}
2019-10-09T23:26:00.625Z fbdbe554-89ca-45dd-83d0-577276e2c382 Error stack: TypeError: Cannot read property 'type' of undefined
at Object.handle (/var/task/index.js:232:57)
at GenericHandlerAdapter.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/handler/GenericHandlerAdapter.js:63:47)
at step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/handler/GenericHandlerAdapter.js:44:23)
at Object.next (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/handler/GenericHandlerAdapter.js:25:53)
at /var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/handler/GenericHandlerAdapter.js:19:71
at new Promise (<anonymous>)
at __awaiter (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/handler/GenericHandlerAdapter.js:15:12)
at GenericHandlerAdapter.execute (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/handler/GenericHandlerAdapter.js:61:16)
at GenericRequestDispatcher.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:173:58)
at step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:44:23)


As well in the payload, I'm getting this

"payload": {
            "purchaseResult": "ERROR",
            "productId": "amzn1.adg.product.e40e814c-aa97-435b-a76d-2db667f20da5",
            "message": "Upsell was not presented."
        },

Thanks,

Phil

alexa skills kitisp
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Phil McGee avatar image
Phil McGee answered

You're not alone - check https://forums.developer.amazon.com/questions/207372/upsell-not-responding.html. I also could not get it to work for my live skill so just handle upsell myself with a normal intent until Amazon fixes it.

1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Will do that too then till' Amazon fixes it. I was just confused that it was not working.

Thank you very much for your answer Phil.

0 Likes 0 ·