【以下的问题经过翻译处理】 2022年8月17日,Amazon Lex V2发布了一种新的与用户管理对话的方式的变更。这个变更好像破坏了与AWS Connect交互流程,如果底层Lambda函数在fulfilled intend响应时发送交互式消息。
以下是我用于测试的AWS Lambda函数:
const isNextStepElicitIntent=true;
const useCustomPayload=true;
exports.handler = async (event) => {
console.log("Request " + JSON.stringify(event));
const customPayload={
"templateType":"ListPicker",
"version":"1.0",
"data":{
"content":{
"title":"Interactive Test",
"subtitle":"Tap to select option",
"elements":[
{"title":"Option 1"},
{"title":"Option 2"}
]
}
}
};
var response;
var message;
if(useCustomPayload){
message={
"contentType": "CustomPayload",
"content": JSON.stringify(customPayload)
};
}
else{
message={
"contentType": "PlainText",
"content":"Help response"
};
}
if (isNextStepElicitIntent){
response = {
"sessionState": {
"sessionAttributes": {},
"dialogAction": {
"type": "ElicitIntent"
}
},
"messages": [
message
]
};
}
else{
response = {
"sessionState": {
"sessionAttributes": {},
"dialogAction": {
"type": "ElicitSlot",
"slotToElicit": "DummySlot"
},
"intent": {
"name": "Help",
"slots": {
"DummySlot": null
}
}
},
"messages": [
message
]
};
}
console.log("Response: " + JSON.stringify(response));
return response;
};
使用在8月17日之前创建的Lex v2 bot,在intent中添加help intent,将“help”作为utterance,并在intent中添加“DummySlot”,在“Code hooks”部分中