{
  "id": "GlbemCHcAaeKcxhC",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Auto Trip Itinerary Planner: Email & WhatsApp Travel Assistant",
  "tags": [],
  "nodes": [
    {
      "id": "9b84fba6-d666-4b88-8e28-bcbd8bf633a0",
      "name": "Itinerary Creator Agent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -380,
        -200
      ],
      "parameters": {
        "text": "={{ $json.textPlain }}",
        "messages": {
          "messageValues": [
            {
              "message": "=Instruction:\n\nYou are a helpful travel planning assistant. Based on the user's message, create a personalized, human-style travel itinerary.\n\nRequirements:\n\nAlways start with a short, warm greeting like:\n\"Hello Traveller,\"\n\nAdd a one-line summary with the destination and top highlights. Example:\n\"Here\u2019s your itinerary for your Dubai adventure! Get ready to explore amazing places like Burj Khalifa, Desert Safari, and Dubai Marina.\"\n\nMatch the number of days mentioned in the user's message. Always create a daily breakdown like this:\nDay 1:\nDay 2:\n...\nDay X: (last day should always be departure day)\n\nFor each day, include:\n\nKey activities with rough time slots (e.g., Morning, Afternoon, Evening)\n\nHotel name suggestion (1 per trip or changes if location shifts)\n\nLocal transport tips (Uber, Metro, cab, etc.)\n\nFlight info if available (or mention \"Arrival\" and \"Departure\")\n\nUse a friendly, conversational tone like you're helping a friend.\n\nKeep the language simple, warm, and easy to read.\n\nAvoid emojis, markdown, or extra formatting.\n\nOutput must always follow this exact structure:\n\nSample Output Format:\n\nHello Traveller,\n\nHere\u2019s your itinerary for your [destination] adventure! Get ready to explore amazing places like [a few highlights based on the destination and user\u2019s message].\n\nDay 1: [Arrival details, hotel check-in, and light local activities like a walk or dinner nearby]\nDay 2: [Morning activity, afternoon sightseeing or shopping, evening relaxation or event]\nDay 3: [Full-day excursion or tour, include meal or caf\u00e9 options, transport]\nDay 4: [Leisure, beach/mall visit, nightlife or shows, optional spa or market visit]\nDay 5: [Departure day \u2013 checkout, transport to airport, and flight info if provided]\n\nBest regards,\nOneclick\n\nExample Input (from email or WhatsApp):\n\"I want to go to Dubai with friends for 5 days\"\n\nExpected Output:\n(Filled-in version of the format above with Dubai-specific content)\n\n\n"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "dfddad63-257b-413a-a05a-c51d66efe223",
      "name": "Agent",
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "position": [
        -292,
        20
      ],
      "parameters": {
        "model": "llama3.2-16000:latest",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8cb4d855-bfcb-4390-890a-5655481a42b2",
      "name": "Get Query from Email",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -600,
        -300
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "imap": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "2b5b9643-e462-4399-b6c4-cfdd4d380a14",
      "name": "Get Query from WhatsApp",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -600,
        -100
      ],
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "66b2e41e-8eb4-47fc-a86c-12ac044743e9",
      "name": "Check Proper Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -4,
        -200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7d428c48-4809-45d8-ba1e-c96d68c02c07",
              "name": "from",
              "type": "string",
              "value": "={{ $('Get Query from Email').first().json.from }}"
            },
            {
              "id": "63b99545-3d2d-4563-b9d7-078cbc20dbcc",
              "name": "subject",
              "type": "string",
              "value": "=Re: {{ $('Get Query from Email').first().json.subject }}"
            },
            {
              "id": "11d94d3f-2170-4b54-b5f9-b85bb95ad472",
              "name": "text",
              "type": "string",
              "value": "={{ $json.text }} "
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a0360062-ca48-4d25-85da-de42b60891d0",
      "name": "Check where to send Answer",
      "type": "n8n-nodes-base.if",
      "position": [
        216,
        -200
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0ff6d913-c904-4d59-b582-f5734473939a",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Get Query from Email').first().json.from }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1469c633-143d-4b64-b20b-4cbbe4f41ed7",
      "name": "Sending Itinery from Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        436,
        -300
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {},
        "subject": "={{ $json.subject }}",
        "toEmail": "={{ $json.from }}",
        "fromEmail": "user@example.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d43a04ad-e7df-4af6-a2bd-65ed6c228669",
      "name": "Send  Itinery from message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        436,
        -100
      ],
      "parameters": {
        "textBody": "={{ $json.text }}",
        "operation": "send",
        "phoneNumberId": "=+918888888888",
        "additionalFields": {},
        "recipientPhoneNumber": "+1234567890"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2b6ab492-16e5-4a5d-aaec-f335ce640b21",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -520
      ],
      "parameters": {
        "width": 480,
        "height": 180,
        "content": "This workflow automatically creates friendly, personalized travel itineraries based on messages received via email or WhatsApp. Whether a user says \"I want to go to Dubai with friends for 5 days\" or something similar, the agent understands the request, generates a detailed daily plan with suggested activities, transport tips, and hotel ideas \u2014 all in a warm, human tone. It saves time, adds value for travelers, and delivers ready-to-send itineraries without any manual effort."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "364ded48-86f9-48e9-92a0-f56a1fd30d59",
  "connections": {
    "Agent": {
      "ai_languageModel": [
        [
          {
            "node": "Itinerary Creator Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check Proper Data": {
      "main": [
        [
          {
            "node": "Check where to send Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Query from Email": {
      "main": [
        [
          {
            "node": "Itinerary Creator Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Query from WhatsApp": {
      "main": [
        [
          {
            "node": "Itinerary Creator Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Itinerary Creator Agent": {
      "main": [
        [
          {
            "node": "Check Proper Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check where to send Answer": {
      "main": [
        [
          {
            "node": "Sending Itinery from Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send  Itinery from message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send  Itinery from message": {
      "main": [
        []
      ]
    }
  }
}