我正在写一个Alexa技能,我只能在我的代码中获得单字参数.
这是intent模式:
{
"intents": [
{
"intent": "HeroQuizIntent",
"slots": [
{
"name": "SearchTerm",
"type": "SEARCH_TERMS"
}
]
},
{
"intent": "HeroAnswerIntent",
"slots": [
{
"name": "SearchTerm",
"type": "SEARCH_TERMS"
}
]
},
{
"intent": "AMAZON.HelpIntent"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我的样本话语是:
HeroQuizIntent quiz me
HeroAnswerIntent is it {SearchTerm}
Run Code Online (Sandbox Code Playgroud)
对于HeroAnswerIntent,我正在检查SearchTerm插槽,我只会在那里找到单个单词.
因此,"彼得帕克"给出"帕克","史蒂夫罗杰斯"给出"罗杰斯","托尼斯塔克"给出"斯塔克".
如何在插槽中接受多个单词?
我有两个使用相同插槽类型的意图.但是,如果输入是随机字符串,则Alexa会自动识别其JSON请求中的意图,即使它不是话语的一部分.例如,在下面的示例中,如果用户输入为'bla bla bla',则将其GetAccountBalance标识为没有插槽值的intent,即使它不是提供的话语的一部分.
对这些情况进行错误检查的方法是什么?在开发意图模式时,避免这种情况的最佳做法是什么?有没有办法创建一个可以处理所有随机输入的意图?
示例架构:
{
"intents": [
{
"intent": "GetAccountBalance",
"slots": [
{
"name": "AccountType",
"type": "ACCOUNT_TYPE"
}
]
},
{
"intent": "GetAccountNumber",
"slots": [
{
"name": "AccountType",
"type": "ACCOUNT_TYPE"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
话语:
GetAccountBalance what is my account balance for {AccountType} Account
GetAccountBalance what is my balance for {AccountType} Account
GetAccountBalance what is the balance for my {AccountType} Account
GetAccountBalance what is {AccountType} account balance
GetAccountBalance what is my account balance
GetAccountBalance what is …Run Code Online (Sandbox Code Playgroud) 尝试在Amazon POST请求中查找Signature和SignatureCertChainUrl标头,以使用刷新令牌续订访问令牌。我故意将访问令牌设置为在3600秒后过期:
var res = {
"access_token": access_token,
"refresh_token": refresh_token,
"expires_in": 3600,
"token_type": "bearer",
"state": state,
"scope": myScope
}
Run Code Online (Sandbox Code Playgroud)
然后应在访问令牌到期后向Alexa进行查询。但是,亚马逊没有按要求完成刷新令牌的请求(引用文档,“ Alexa还会使用刷新令牌来调用[访问] URI,以便在先前的令牌到期时获得新的访问令牌”)。
如何测试我的技能对使用刷新令牌获取新访问令牌的响应?
Alexa和Google Analytics等服务如何能够跟踪访问者的年龄,性别,大学教育等等?
我的AMAZON.StopIntent搞砸了.无论我放在那里(我已经尝试了每个教程中的所有内容),无论何时调用,我都会得到"所请求技能的响应存在问题",并且Alexa应用程序将错误显示为"speechletresponse不能为空".我的项目是JSON,而不是Java格式.
如果有人可以提供帮助,我将非常感激!
谢谢!
根据要求,这是发送给Lambda的内容
{
"session": {
"sessionId": "SessionId.XXXXX",
"application": {
"applicationId": "amzn1.ask.skill.XXXXXXX"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.XXXXXXX"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.XXXXXX",
"locale": "en-US",
"timestamp": "2017-01-18T22:38:53Z",
"intent": {
"name": "AMAZON.StopIntent",
"slots": {}
}
},
"version": "1.0"
}
Run Code Online (Sandbox Code Playgroud)
以下是相关代码:
var handlers = {
'LaunchRequest': function () {
this.emit('AMAZON.HelpIntent');
},
'GetNewDogThoughtIntent': function () {
this.emit('GetDogThought');
},
'GetNewCatThoughtIntent': function () {
this.emit('GetCatThought');
},
'GetDogThought': function () {
var dogthoughtIndex = Math.floor(Math.random() * DOGTHOUGHTS.length);
var randomDogThought …Run Code Online (Sandbox Code Playgroud) 我正在开发一个带有一个Intent的Alexa技能,其中包含一个带有几个可能值的Slot.
我的槽与所定义"name" : "Channel","type" : "LIST_OF_CHANNELS"和值
如何检索要在Lambda函数中使用的发出的槽值?这是"从话语部分检索插槽的价值"我希望得到回答.非常感谢.
// retrieve value of slot from utterance
var c = intent.slots.Channel.value;
// append value to end of URL that references API
fetchEnseParse("/channel/" + c, function(body) {
// continuation of this function is below
Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个Alexa技能,其中Alexa说的是用SSML标记的东西.我试图模仿这个回购中的例子,但我总是收到一个lambda响应
{
...
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak> [object Object] </speak>"
},
...
}
Run Code Online (Sandbox Code Playgroud)
和Alexa字面上说"对象对象".
这是我输入到我的lambda函数(使用node.js):
var speechOutput = {
type: "SSML",
ssml: 'This <break time=\"0.3s\" /> is not working',
};
this.emit(':tellWithCard', speechOutput, SKILL_NAME, "ya best not repeat after me.")
Run Code Online (Sandbox Code Playgroud)
像这样设置speechOutput也不起作用:
var speechOutput = {
type: "SSML",
ssml: 'This <break time=\"0.3s\" /> is not working',
};
Run Code Online (Sandbox Code Playgroud)
index.js
'使用严格';
var Alexa = require('alexa-sdk');
var APP_ID = "MY_ID_HERE";
var SKILL_NAME = "MY_SKILL_NAME";
exports.handler = function(event, context, …Run Code Online (Sandbox Code Playgroud) 有没有办法使用CLI配置Alexa技能?
我理解如何使用CLI设置和管理相应的Lambda代码,但我认为无法对Alexa技能做同样的事情(例如设置或上传更新的Intent Schema或插槽等).
有没有办法做到这一点,还是Alexa开发者控制台唯一可用的方法?
command-line-interface amazon-web-services alexa alexa-skills-kit
我正在研究Claudia.js机器人,可以通过Slack,FB messenger和Alexa技能联系到.据说在claudia中,你可以返回纯文本,框架会正确地将它返回到"前端"......我目前在这里使用FB和Slack可以正常工作,但是当我通过Alexa"服务模拟器"访问它时我总是得到"答复无效".这是使用Claudia.js的lambda.基本上它从客户端获取消息,然后将它们分流到另一个是"AI"的Lambda.Alexa似乎在第67行窒息.想法?
const promiseDelay = require('promise-delay');
// const aws = require('aws-sdk');
// const lambda = new aws.Lambda();
const lambda = require('aws-lambda-invoke');
const botBuilder = require('claudia-bot-builder');
const stackTrace = require('stack-trace');
//const slackDelayedReply = botBuilder.slackDelayedReply;
const getIntentName = alexaPayload =>
alexaPayload &&
alexaPayload.request &&
alexaPayload.request.type === 'IntentRequest' &&
alexaPayload.request.intent &&
alexaPayload.request.intent.name;
const api = botBuilder((message, apiRequest) => {
console.log = console.log.bind(null, '[LOG]');
console.info = console.info.bind(null, '[INFO]');
console.error = console.error.bind(null, '[ERROR]');
console.warn = console.warn.bind(null, '[WARN]');
console.info(message, apiRequest);
console.log(apiRequest.body);
const requestData = {
'user-id': …Run Code Online (Sandbox Code Playgroud) 我一直在努力让技能管理 API 工作,今天早上我遇到了一个新的障碍,但没有任何改变。我收到一条“昨晚用户没有同意这个操作错误”并且今天早上没有改变任何东西,这是我得到的 curl 日志:
尝试使用与昨晚相同的代码访问 API,现在我得到:
string(513) "
* Hostname api.amazonalexa.com was found in DNS cache
* Trying 54.239.28.187...
* TCP_NODELAY set
* Connected to api.amazonalexa.com (54.239.28.187) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.amazonalexa.com:443
* stopped the pause stream! * Closing connection 0 "
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的代码:
ob_start();
$out = fopen('php://output', 'w');
// exchange the access token for …Run Code Online (Sandbox Code Playgroud) alexa ×10
node.js ×4
aws-lambda ×3
alexa-skill ×2
chatbot ×1
claudia.js ×1
curl ×1
oauth-2.0 ×1
php ×1
ssml ×1