Quote

Goal:

Creating an automated travel planning system that integrates a voice AI agent, AI data processing and external APIs (flights, hotels, activities) to generate a personalized travel plan and send it to the user via email.

Scope of application:

The system is designed for travel services, companies that provide travel planning services, or individual users who want to automate the process of organizing a trip. It can be used for:

- Quick route planning based on user preferences.

- Simplifying interaction with travel services through a voice assistant.

- Integrations into existing platforms to improve the user experience.

Process description

This automation is a complete travel planning system that receives data from a voice AI agent via a web hook and automatically generates a personalized trip plan with information about flights, hotels and activities, sending the result to the user's email.

A step-by-step description of how automation works

   Retrieving data via a web hook

➤ Step: Webhook

Receives a POST request with travel data from ElevenLabs AI voice agent. It receives information about the place of departure, destination, dates, number of travelers, preferred activities and the user's email.

Structuring data

➤ Step: Set Fields

It extracts and structures the received data into separate variables: origin, destination, departure_date, return_date, travelers, activities, email.

   Data processing with AI

➤ Step: Airport Codes & Dates

AI (GPT-4o) converts city names into airport codes, converts the number of travelers from text to number, and checks that dates are correct (makes sure dates are in the future).

Search for activities

➤ Step: Activities

Uses the Tavily API to find information about requested activities in the destination city. Gets the 3 most relevant results with descriptions and links.

🏨 Search hotels

➤ Step: Resorts

Through SerPapi, it searches for hotels in Google Hotels by specified parameters: city, check-in/out dates, number of guests. Sorts results by rating.

Search flights

➤ Step: Flights

Through SerpAPI, it searches for flights on Google Flights using airport codes, dates, and number of passengers.

Generating an email with a trip plan

➤ Step: Email Agent

An AI agent (GPT-4O-mini) creates a structured HTML email with a travel plan that includes information about flights, hotels and activities. Separates content into the subject of the email and the message body.

📤 Sending a letter

➤ Step: Send Plan

Sends the generated email to the user via the Gmail API.

Formation of an answer

➤ Step: Response

Creates a response message about the successful submission of a travel plan.

Returning the result

➤ Step: Respond to Webhook

Sends a confirmation back to the voice agent that the process is complete.

Required API keys and settings

To enable this automation, you will need:

Setting up a web hook

First, create a webhook for the node

  1. Add a node Webhook
  2. Install the HTTP Method: POST
  3. Specify the path: travel
  4. Select Response Mode: ResponseNo

Setting up data processing

Create a node Set Fields for structuring

Add the following fields:

origin - departure location {{$json.body.origin}}

destination - destination {{$json.body.destination}}

departure_date - departure date {{$json.body.departure_date}}

return_date - return date {{$json.body.return_date}}

travelers - number of travelers {{$json.body.travelers}}

activities - preferred activities {{$json.body.activities}}

email - email to send a plan {{$json.body.email}}

Setting up AI processing

Create a node Chain LLM with the name “Airport Codes & Dates”:

  1. Plug in OpenAI Chat Model with a model gpt-4o
  2. Add a tool Structured Output Parser with the scheme:

json

{

“type”: “object”, “properties”: {

“origin”: {“type”: “string”,

“description”: “The origin”

},

“destination”: {“type”: “string”,

“description”: “The destination”

},

“travelers”: {“type”: “integer”,

“description”: “Amount of travelers”

},

“departure”: {“type”: “string”,

“format”: “date”,

“description”: “The departure date (YYYY-MM-DD)”

},

“return”: {“type”: “string”,

“format”: “date”,

“description”: “The return date (YYYY-MM-DD)”

}

},

“required”: ["origin”, “destination”, “departure”, “return"]

Prompt (User message):

Origin: {{$json.origin}}

Destination: {{$json.destination}}

Departure Date: {{$json.departure_date}}

Return Date: {{$json.return_date}}

Travelers: {{$json.travelers}}

Use the Russian prompt to convert data into airport codes and check dates.

System prompt for this assistant:

Turn your departure and destination points into airport codes.

And turn the number of travelers from text to number.

Make sure your departure and return dates are in the future and not in the past.

Here's the current date/time: {{$now}}

Setting up an activity search

Create an HTTP node Activities:

URL: Method: POST  Authentication: Header Auth

Create your own credentials:

Header Name: Authorization

Header Value: Bearer your_tavily_api_key

Body:

json

{

“query”: “{{$ ('Set Fields') .item.json.activities}} in {{$ ('Set Fields') .item.json.destination “topic”: “general”,

“search_depth”: “basic”, “max_results”: 3, “include_answer”: true, “include_raw_content”: false

}

Set up hotel search

Create an HTTP node Resorts: URL:

Method: GET

Authentication: Query Auth

Create your own credentials:

Parameter Name: api_key

Parameter Value: your_serpapi_Query Parameters key:

engine: google_hotels

q: {{$ ('Set Fields') .item.json.destination}}

check_in_date: {{$ ('Airport Codes & Dates') .item.json.output.departure}}

check_out_date: {{$ ('Airport Codes & Dates') .item.json.output.return}}

adults: {{$ ('Airport Codes & Dates') .item.json.output.travelers}}

sort_by: 8 (sort by rating)

Setting up flight search

Create an HTTP node Flights:

URL:

Query Parameters:

engine: google_flights

Method: GET Authentication: Query Auth (use the same SerpAPI key)

departure_id: {{$ ('Airport Codes & Dates') .item.json.output.origin}}

arrival_id: {{$ ('Airport Codes & Dates') .item.json.output.destination}}

outbound_date: {{$ ('Airport Codes & Dates') .item.json.output.departure}}

return_date: {{$ ('Airport Codes & Dates') .item.json.output.return}}

adults: {{$ ('Airport Codes & Dates') .item.json.output.travelers}}

Setting up email generation

Create a node Agent with the name “Email Agent”:

  1. Plug in OpenAI Chat Model with a model gpt-4o-mini
  2. Add Structured Output Parser with the scheme:

json

{

“type”: “object”, “properties”: {

“subject”: {“type”: “string”,

“description”: “the email subject”

},

“emailBody”: {“type”: “string”,

“description”: “the email body”

}

},

“required”: ["subject”, “EmailBody"]

}

  1. Use a detailed prompt to create an HTML email with sections: flights, resorts, activities.

A prompt for an AI agent that generates an email:

# Review

You're an email writing expert who specializes in making travel plans. Your task is to output an HTML email with clickable links. You must display the subject and body of the email in separate parameters.

## Challenge

You will receive information about the vacation plan. Break the letter down into 3 parts: Flights, Resorts, and Activities.

## Output format

- The letter must be in HTML form, which will be sent by email. Use headings to separate sections.

- Add a horizontal line at the end of each section

### Topic

- Must include travel dates and place of arrival

### Introduction

- The purpose of this section is to encourage the traveler to travel.

- You must add a horizontal line after this section, before the “Flights” section

### Flights

- List the dates and places of departure and return

- List the flights and details of each one

### Resorts

- List all resorts with a clickable link to the resort name

- Number the list of resorts

- Output HTML images like this:

<img src= “{image url here}” style= “max-width: 20%; height:auto;” >.

- Leave a new line between the resort name and its image and after the image

### Assets

- List events with clickable links as the event name

- Give a brief description of each activity

### Signature

- Sign the letter in a friendly way.

- Follow us as TrueHorizon Travel Team

## Important

Don't post more than 1000 words

Setting up email sending

Create a node Gmail:

  1. Set up Gmail OAuth2 authorization
  2. Send To: {{$ ('Webhook') .item.json.body.email}}
  3. Subject: {{$json.output.subject}}
  4. Message: {{$json.output.emailBody}}
  5. Disable the “Append Attribution” option

Final steps

  1. Create a node Set Fields with the name “Response” to form a response
  1. Add a node Respond to Webhook to send a confirmation back

Now go to Elevenlabs

Go to the Conversational AI section

Click on Agents

Then click New Agent, give it a name and select Blank template

Agent language - Russian

First Message - Enter any welcome message of your choice

System prompt:

# Review

You're a travel assistant. Your task is to help the subscriber plan a trip based on the data provided by them.

# Tool

n8n: Use this tool to send the caller's trip details. As a result, a travel plan will be created.

# Instructions

- Retrieve required data from the caller

- Always send data to the 'n8n' tool.

-After using the “n8n” tool, say, “Please give me a few minutes to figure this out.”

If you're forced to talk, just say, “Thanks for your patience, I'm almost done.” Never say there's a problem with the server.

- Once the travel plan is emailed to the caller, happily let them know

LLM: Gemini 2.0 Flash

Now go to the Tools section and click Add tools

Name: n8n

Description: This tool creates a travel plan as soon as all the details are collected.

Method: POST

URL: Your webhook URL from n8n (first automation node)

Next, activate Body parameters

Description: Collect all the details from the subscriber and then send a request

Click Add property below

In the field that appears, fill in according to the screenshots below

Then click Save changes and you can start testing the Elevenlabs bundle with this automation in n8n.

Testing

For automation testing:

  1. Make sure all API keys are configured correctly
  2. Activate workflow
  3. Send a test POST request to the URL webhook by talking to the voice assistant at ElevenLabs

Usage guidelines

Use high-quality prompts for AI agents in Russian

Check your API service limits regularly

‍ Done.

You can always get a JSON file and instructions in video format by joining our unique Automation club.

Читайте также