[英]How to add in a listen or timeout function in autopilot?
我有一個語法問題,我相信我的自動駕駛儀響應可以正常工作。 我的程序可以運行,但是在自動駕駛儀問了問題之后,用戶沒有太多時間在停止/掛斷電話之前說出響應。
有沒有辦法添加超時或暫停? 我已經嘗試過為此語法,但它不起作用。 這就是我所擁有的:
"actions": [
{
"collect": {
"name": "user_input",
"questions": [
{
"question": "Welcome to the modem status check line?",
"name": "search",
"type": "Twilio.NUMBER"
}
],
"on_complete": {
"redirect": {
"method": "POST",
"uri": "https://website......"
}
}
}
}
]
}
當我在下面添加
{
"listen":true
}
此語法中的任何地方均不起作用,並給我以下錯誤:.actions [0] .collect.questions [0]不應具有其他屬性
我也嘗試了超時:3,它也不起作用。
我努力了
{
"listen":true
}
和
"listen": {
在我的任務之前
Twilio開發人員布道者在這里。
您不能在“ Collect
流中使用“ Listen
屬性,並且沒有簡單的方法來添加超時或暫停。 但是,您可以像這樣將“ Validate
操作添加到您的“ Collect
流程中,並增加max_attempts
的數量,以便您的Autopilot機器人重復該問題或要求用戶重試/再次說出他們的回答。
我想知道為什么會這樣,因為當我通過電話使用我的機器人時,電話會保持打開狀態很長一段時間,以等待用戶的響應。
exports.handler = function(context, event, callback) {
const responseObject = {
"actions": [
{
"collect": {
"name": "collect_clothes_order",
"questions": [
{
"question": "What is your first name?",
"name": "first_name",
"type": "Twilio.FIRST_NAME"
},
{
"question": "What type of clothes would you like?",
"name": "clothes_type",
"type": "CLOTHING",
"validate": {
"on_failure": {
"messages": [
{
"say": "Sorry, that's not a clothing type we have. We have shirts, shoes, pants, skirts, and dresses."
}
],
"repeat_question": true
},
"on_success": {
"say": "Great, I've got your the clothing type you want."
},
"max_attempts": {
"redirect": "task://collect_fallback",
"num_attempts": 3
}
}
}
],
"on_complete": {
"redirect": "https://rosewood-starling-9398.twil.io/collect"
}
}
}
]
};
callback(null, responseObject);
};
讓我知道這是否有幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.