Rate this page:

Deep Table Restaurant Assistant Tutorial

Deep Table is not only known to be one of the world's best restaurants but it's also the world's smartest restaurant.

In this quickstart, we are going to build a virtual assistant for the imaginary restaurant Deep Table. It will be able to tell guests about the daily special as well as book reservations asking for the first name, party size, and reservation date. At the end of this tutorial, you should have a fully working assistant working for Deep Table.

Create an assistant and look around

To create your assistant, visit the Autopilot home in your Twilio console. Then:

  • click the red plus sign to create a new assistant
  • give your assistant a name
  • click the red Submit button

Take some time to look around your new assistant home in the console:

  • Click on Task Builder and see where you'll create tasks that power your assistant.
  • Click Natural Language Router and then Build Models to see where you can create machine learning models for performing natural language understanding.

Connect a phone number to the assistant

  • Buy a phone number or select a number you own and go to the number configuration page
  • Scroll down to the Webhooks section.
  • Enter the following URL as the Voice URL:<ACCOUNT_SID>/<ASSISTANT_SID>/twilio-voice
  • Enter the following URL as the Messaging URL:<ACCOUNT_SID>/<ASSISTANT_SID>/twilio-messaging
  • Make sure you replace the AccountSid and Assistant Sid with your own values. (You can get your Twilio Account SID from the Twilio Console and Assistant SID from the Assistant Console List)

Create the get-specials Task

  • Click on Task Builder and you'll land on the Tasks page
  • Click on the red plus sign to create a Task and name it get-specials
  • Modify the JSON to tell customers about the Daily Special:
  "actions": [
			"say": "Todays special is duck confit with roasted brussel sprouts"
  • Add Samples to the get-specials task
What's today's specials?
what is the special today
do you have a special today
what do you have for special today
I want today's special
dinner special
today's special
get today's special
Can you tell me what's the special today
are there any specials

At this point the task is fully built, but you still need to change your intent actions task to listen for user input.

  • From the Tasks view, toggle to the Initiation task. This specifies how your assistant will interact with users who call it.
  • Modify the default JSON to explain what the assistant does and listen for user input
	"actions": [
			"say": "Welcome to Deep Table, the worlds smartest restaurant, I'm Deep Table's Virtual Assistant, I can tell you about todays special or help you make a reservation, What would you like to do today?"
			"listen": true

Lastly, to build all these changes into the machine learning model you need to create a new Model Build.

  • Click on Natural Language Router -> Build Models. Once the build is complete go to Logs and create a query.
  • Enter: "What's today's special?".
  • The natural language understanding should identify that the expression corresponds to the get-specials task.

Give your assistant a call and say "what's today's special". If all goes well, you should hear today's special.

  • You'll notice the call hangs up. To continue the interaction and ask for user input modifying the get-specials to ask if the user needs anything else and add the listen action:
	"actions": [
			"say": "Today's special is duck confit with roasted Brussels sprouts, super recommended, is there anything else I can help you with?"
			"listen": true

Create the make-reservation Task

Now we're going to create the make-reservation Task.

  • Go to the Task Builder and click the red plus sign and create a task called make-reservation
  • Use the Collect action to ask the user their first name, time, date and party size for the reservation.
  • Modify the JSON to tell customers you can help them with their reservations:
	"actions": [
			"collect": {
				"name": "make_reservation",
				"questions": [
						"question": {
							"say": "Great, I can help you with that. What's your first name?"
						"name": "first_name",
						"type": "Twilio.FIRST_NAME"
						"question": {
							"say": "When day would you like your reservation for?"
						"name": "date",
						"type": "Twilio.DATE"
						"question": {
							"say": "Great at what time?"
						"name": "time",
						"type": "Twilio.TIME"
						"question": {
							"say": "For how many people"
						"name": "party_size",
						"type": "Twilio.NUMBER"
				"on_complete": {
					"redirect": {
				        "uri": "REPLACE THIS!!!",
				        "method": "POST"

Now we are going to add samples.

  • Add these samples:
book a table
make a reservation
I want to make a reservation
I need a table
I want to book a table
I'd like to make a reservation please
I would like to make a reservation
I'm looking for a table for dinner
make reservation
make reservation please

Now we have make-reservation ready. Build a model to bake the changes in.

  • Go to Natural Language Router -> Build Models

Now we can test out the model in the Logs.

  • Click the plus sign to create a new query and enter "I want to make a reservation"
  • You should see the natural language understanding recognizing that it is a make-reservation task.

Give the assistant a call from your phone and say "I want to make a reservation". You should hear in response "I can help you make a reservation".

Connect to a function

We are going to mimic a real reservation system with a Twilio Function. It will evaluate what fields we have collected already and ask for fields we are missing.

  • In the console, go to Runtime -> Functions and click Create Blank. (Or click here then create)
  • Copy paste the following Function then click Save.
  • Make sure to name your function: deep-table
exports.handler = function(context, event, callback) {
    var moment = require('moment');
    let responseObject = {};
  let memory = JSON.parse(event.Memory)

  let first_name = memory.twilio.collected_data.make_reservation.answers.first_name.answer || '';
  let reservation_date = || '';
  let reservation_time = moment(memory.twilio.collected_data.make_reservation.answers.time.answer, "hhmm").format("HH:mm a") || '';
  let party_size = memory.twilio.collected_data.make_reservation.answers.party_size.answer || '';

  console.log("First name: "+first_name );
  console.log("Reservation date: "+reservation_date);
  console.log("Reservation time: "+reservation_time);
  console.log("Party size: "+party_size);

  let message = "Ok "+first_name+". Your reservation for "+reservation_date+" at "+reservation_time+" for "+party_size+" people is now confirmed. thank you for booking with us";
  responseObject = {"actions":[
    { "say": { "speech": message } }
    callback(null, responseObject);

This function reads back to the user the information that was collected.

Once we have the function deployed:

  • Copy paste the URL of the function on the Collect -> On Complete redirect.

Create the make-reservation Task

  • Click Save.
  • Give the assistant another call and say "I want to make a reservation".
  • It should prompt you for your name, party size, and date.
  • First name: "Mike"
  • Party size: "Seven"
  • Date: "Tomorrow"

Finally, it should confirm your reservation.

Congratulations, you have successfully built the Deep Table Assistant with Autopilot!

Nico Acosta Kat King Jose Oliveros Paul Kamp Lizzie Siegle
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.


        Thank you for your feedback!

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

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more