Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

メニュー

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Listen

The Listen action instructs the Assistant to wait for user input, keeping the dialogue alive. If there is no Listen action the dialogue will end.

The Listen action can have one property: tasks, that allows you to constrain the listen to a subset of tasks.

On messaging channels (including SMS, Chat, FB Messenger, or Slack), the Listen action will wait for user response for 4hrs. If there is no user response the dialogue will timeout.

The Listen action has one optional property:

プロパティ 概要 オプション
tasks The tasks you want to constrain the listen to. はい

Example 1: Ask a question and wait for an answer

{
	"actions": [
		{
			"say": {
				"speech": "Hello! how can I help you"
			}
		}, {
		    "listen":true
		}
	]
}

In the above example, the Assistant will ask the question and keep the dialogue open waiting for an answer.

Example 2: Constrain the listen to a subset of tasks

With the tasks property, you can constrain the tasks that the Assistant listens to.

{
	"actions": [
		{
			"say": {
				"speech": "What would you like to do? Continue shopping or check out?"
			}
		},
		{
			"listen": {
				"tasks": [
					"search-for-product",
					"checkout"
				]
			}
		}
	]
}
Rate this page:

ヘルプが必要ですか?

誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。