2017-04-05 65 views
1

我正在嘗試在移動應用程序中創建一個卡,該應用程序連接到亞馬遜賬戶和當前技能。亞馬遜Alexa技能 - 創建移動應用程序卡

只要用'tellWithCard'調用EMIT函數就夠了嗎?就像例如:

that.emit(':tellWithCard', "Thank you for your visit", "Store Name", "Some description") 

我想這一切功能分開,但對我不起作用:

that.emit(':tellWithCard', message, "Store Name", description) 
that.emit(':tellWithLinkAccountCard', message, "Store Name", description) 

that.emit(':askWithCard', message, "Store Name", description) 
that.emit(':askWithLinkAccountCard', message, "Store Name", description) 

是否有任何額外的功能應該是什麼?

回答

1

是的,這就是你所需要的。

下面是一個例子: (從原來的回購的README兩者)​​

var cardTitle = 'Hello World Card'; 
var cardContent = 'This text will be displayed in the companion app card.'; 

var imageObj = { 
    smallImageUrl: 'https://imgs.xkcd.com/comics/standards.png', 
    largeImageUrl: 'https://imgs.xkcd.com/comics/standards.png' 
}; 

this.emit(':tellWithCard', 'lalalala', cardTitle, cardContent, imageObj); 

做驗證來自服務模擬器你應該得到這樣的迴應:

{ 
    "version": "1.0", 
    "response": { 
    "outputSpeech": { 
    "type": "SSML", 
    "ssml": "<speak> lalalala </speak>" 
    }, 
    "card": { 
    "text": "This text will be displayed in the companion app card.", 
    "title": "Hello World Card", 
    "image": { 
     "smallImageUrl": "https://imgs.xkcd.com/comics/standards.png", 
     "largeImageUrl": "https://imgs.xkcd.com/comics/standards.png" 
    }, 
    "type": "Standard" 
    }, 
    "shouldEndSession": true 
    }, 
    "sessionAttributes": {} 
} 

但請記住,服務模擬器的測試不會在Alexa應用程序中創建實際的卡。爲此,您需要使用設備。

+0

感謝您的回答。是的,我也以這種方式在設備上嘗試過。設備連接到同一個帳戶...但可能我做錯了什麼,而不是這部分的實施。你有什麼其他的想法會影響卡片發送嗎? –

+0

你在服務模擬器中得到這樣的答案嗎? – imTachu

+0

是的。我在「text」模擬器中,在https://echosim.io/ simulator中,在「測試」執行中,在真實設備上作爲語音信息接收答案,甚至通過HTTP POST將記錄接收到外部系統(用於測試,稱爲之前發出) 晚上在亞馬遜帳戶有一些特殊的配置? –

相關問題