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