u/Charming_You_8285

I built an automated Hotel Room Access pin generation workflow
▲ 6 r/n8n_ai_agents+2 crossposts

I built an automated Hotel Room Access pin generation workflow

Workflow Code:
https://gist.github.com/iamvaar-dev/6544545160d058f716b121e7e38e52bc

Pre-requesties:
- Apaleo Client id and secret.

- Apaleo basic authentication key which we recieve just after creation of the dev app.

- seam.co Api key as we need it to generate smart lock pin.

- Twillio API

Workflow 1: Smart Lock PIN Generation & Notifications

This is the primary workflow that runs whenever a room is assigned to a guest.

  1. When Reservation Unit Assigned (Apaleo Trigger)
    • What it does: This is the starting point. It listens for a specific webhook event from Apaleo (reservation/unit-assigned). As soon as a staff member assigns a physical room to a booking, this node triggers the automation.
  2. Fetch Reservation Details (Apaleo Node)
    • What it does: It takes the ID from the trigger node and makes a request (BookingReservationsByIdGet) to Apaleo to grab the full details of the reservation, specifically the arrival and departure times needed for the smart lock.
  3. Map Room ID to Lock ID (Code Node)
    • What it does: This runs custom JavaScript to match the Apaleo room string (e.g., "BER-VWD 1.001") against a hardcoded database of your physical locks. It finds the corresponding Seam locker_id and prepares a clean JSON payload containing the device ID, reservation ID, and the exact start/end times for the lock access.
  4. Post Access Code to Seam (HTTP Request Node)
    • What it does: It sends a POST request to Seam's API (/access_codes/create) using the data prepared in the previous step. Seam generates a unique PIN that will automatically activate at check-in time and expire at check-out time.
  5. Append PIN to Reservation Note (Apaleo Node)
    • What it does: Uses a PATCH request to update the Apaleo reservation. It takes the newly generated PIN from Seam and saves it directly into the reservation's comments/notes so hotel staff have a record of it.
  6. Fetch Customer Contact Data (HTTP Request Node)
    • What it does: Makes another call to Apaleo's API using a Bearer token to pull expanded customer details, specifically the primaryGuest and booker profiles. This is required to get the guest's email address and phone number.
  7. Send Email via Gmail (Gmail Node) & Send PIN via Twilio (Twilio Node)
    • What they do: The workflow splits into two parallel actions here.
      • The Gmail node takes the customer's email and sends a beautifully formatted, custom HTML email containing their secure PIN and instructions.
      • The Twilio node simultaneously takes the customer's phone number and sends a concise SMS text message with the PIN for easy access on the go.

Workflow 2: Automated API Token Rotation

Because the Apaleo Bearer token (used in the "Fetch Customer Contact Data" node) likely expires every 60 minutes, this background workflow runs independently to refresh it.

  1. Every 58 Minutes Trigger (Schedule Trigger Node)
    • What it does: Acts as a cron job, firing off this secondary sequence exactly every 58 minutes.
  2. Fetch Access Token (HTTP Request Node)
    • What it does: Sends a POST request to Apaleo's identity server (identity.apaleo.com/connect/token) using a static Basic Auth key to request a brand new, short-lived access token.
  3. Patch API Credential (HTTP Request Node)
    • What it does: This is a clever use of the n8n API itself. It takes the fresh token fetched in the previous step and makes a PATCH request to your n8n instance. It dynamically overwrites the existing "Apaleo Bearer Auth" credential saved in n8n. This ensures that Workflow 1 always has a valid token when it needs to fetch customer data.
youtu.be
u/Charming_You_8285 — 16 hours ago
▲ 5 r/n8n_ai_agents+2 crossposts

I built an N8N appointment agent with GoHighLevel integration

Hi, I am Vaar an automation dev just like most of you here 😄

Workflow Link: https://gist.github.com/iamvaar-dev/4a94ecac1296325d0484df2d581314f6

Here is a node-by-node explanation:
This workflow operates as an AI-powered customer service assistant for an HVAC company, communicating with customers via WhatsApp and managing contacts and appointments in GoHighLevel (GHL).

1. Core Execution Flow (The Main Pathway)

These nodes form the step-by-step sequence of actions triggered when a user sends a message.

  • WhatsApp Trigger
  • Purpose: This is the entry point of the workflow. It constantly listens for incoming WhatsApp messages.
  • Function: When a user sends a message, this node captures the payload, including the user's phone number and the text message they sent.
  • If Valid Sender Exists
  • Purpose: Acts as a safety check/filter.
  • Function: It checks the incoming data from the WhatsApp Trigger to ensure the sender's phone number ($json.messages[0].from) is not empty. If valid, the workflow proceeds to the "True" branch.
  • Fetch GHL Contacts
  • Purpose: Database lookup.
  • Function: It takes the sender's phone number from the trigger and searches GoHighLevel (GHL) to see if a contact profile already exists for this user. It always outputs data, passing either the found contact details or an empty result to the next node.
  • Customer Service AI Agent1
  • Purpose: The "brain" of the operation. This is a LangChain Agent node.
  • Function: It receives the user's message, the current date/time, and the contact information fetched from GHL. Following an extensive system prompt, it adopts the persona of "Alex" to understand the customer's HVAC issue, ask for missing contact details (if the GHL lookup failed), and determine the next best action (using tools or chatting). Once it formulates a final response, it passes it down the line.
  • Send WhatsApp Response
  • Purpose: The final action in the standard flow.
  • Function: It takes the final text output generated by the AI Agent and sends it back to the user's phone number via WhatsApp.

2. AI Agent Inputs (The "Brain's" Resources)

These nodes are connected directly to the AI Agent to provide it with intelligence, memory, and the ability to interact with external systems.

  • Gemini Chat Model
  • Purpose: The Language Model.
  • Function: Powered by Google Gemini, this node processes the natural language, understands the user's intent, and generates conversational text based on the Agent's instructions.
  • Redis Chat History Memory
  • Purpose: Conversational memory.
  • Function: It stores the back-and-forth chat history using Redis. It uses the user's WhatsApp phone number as a unique session key. This ensures that if the user sends multiple messages, the AI remembers what was said earlier in the conversation (up to 15 messages).

3. AI Tools (The Agent's Actions)

These are specialized HighLevel tool nodes that the AI Agent can choose to "trigger" autonomously during the conversation to fulfill its instructions.

  • Create or update a contact in HighLevel
  • Purpose: Lead capture.
  • Function: If the initial "Fetch GHL Contacts" node found no record, the AI is instructed to ask for the user's Name and Email. Once provided, the AI uses this tool to automatically create a new contact in GHL using those details plus their WhatsApp number.
  • Save user issue in notes
  • Purpose: Record keeping.
  • Function: When the user describes their HVAC problem (e.g., "My AC is blowing warm air"), the AI immediately triggers this tool to write a summary of the issue directly into the user's GHL contact notes.
  • Fetch Available Calendar Slots
  • Purpose: Checking availability.
  • Function: Before offering appointment times, the AI uses this tool to check the GHL calendar. It inputs a start and end date (in Unix timestamps), and the tool returns a list of free 30-minute slots.
  • Book Calendar Appointment
  • Purpose: Finalizing the service.
  • Function: Once the user agrees on a specific time, the AI uses this tool to officially book the appointment in the GHL calendar using the Contact ID, Calendar ID, and the agreed-upon Start Time (in ISO 8601 format).

Summary of the Workflow Interaction:

  1. A user texts via WhatsApp.
  2. The system checks if they are an existing GHL Contact.
  3. The AI Agent (Gemini) reads the message, recalling past context from Redis.
  4. The AI chats with the user, autonomously using Tools to create their profile, save their AC/Heating issues, check the calendar, and book a timeslot.
  5. The AI sends the conversational reply back via WhatsApp.

Let me know if you had any questions regarding this workflow. I would love to explain you this.

Thanks,
Vaar

youtu.be
u/Charming_You_8285 — 6 days ago
▲ 3 r/n8n_ai_agents+2 crossposts

How I Built a Weather-Triggered HVAC Booking System using n8n & GoHighLevel

Hi, I am Vaar an automation dev just like most of you here 😄

Well I do youtube only for a portfolio purpose, slowly started loosing interest in recording videos as I am a terible explainer... but recently I recieved a DM asking to record the video how this actually works in my own words from this post: https://www.reddit.com/r/n8n/comments/1t8jyny/i_built_a_weather_based_upsell_for_hvac/

So this post is for that one person and any other people who can bear my messy non-sense... but this is me :) no sugar coating

And really sorry about my explanation. I usually talk well but recording alone feels like i am talking with myself lol. so sorry for the mess...

Workflow Code Link: https://gist.github.com/iamvaar-dev/e1b968be2ee1bf5c3bbf4e5c4f1ea2f9

This project is specifically built for a HVAC business where the system automatically upsell to old customers when thier locality have any heat wave or snow wave forecast in the upcomming 5 days.

Firstly pre-requesties:

  1. Gohighlevel:
  2. - Create Custome Fields: a. stop_whatsapp[used when user replied STOP to remove from the marketing list] b. opp_type[heatwave or snowwave]
  3. - Create two pipelines: a:HEATWAVE, b: SNOWWAVE and both pipelines will have 4 stages i.e new lead, contacted, scheduled, closed

- Grab the calender id in Gohighlevel with you as it will be needed in the workflow to look for free slots and books an appointment.

  1. Whatsapp:
    - Create a marketing template in meta business suite for heatwave & snowwave:
    a. Heatwave:
    Hello {{1}},

With temperatures expected to rise soon, we wanted to share a few tips to keep your home comfortable and your AC running efficiently.

Maintenance Tips:
• Keep blinds closed during peak sun hours.
• Check your air filters; a clean filter prevents overworking.
• If you leave the house, raise the thermostat a few degrees rather than turning it off.

Need help?
If your system is struggling to keep up, we are here to assist.

Stay cool and safe!

b. Snow wave:

Hello {{1}},

With a cold front and freezing temperatures expected soon, we wanted to share a few tips to keep your home warm and your heating system running efficiently.

Winter Comfort Tips:
• Keep curtains and blinds open during the day to let sunlight naturally warm your home, then close them at night to trap the heat.
• Check your air filters; a clogged filter makes your heater work much harder in freezing weather.
• Ensure your outdoor vents and heat pump units are clear of snow or debris to maintain proper airflow.

Need help?
If your heating system is struggling to stay warm or making unusual noises, we are here to assist.

Stay warm and safe!

  1. Read Nominatim openstreet API Docs[which we use it for city extraction from address]
    and thanks a lot for the Nominatim contributors for keeping the project opensource.

  2. Get a free api from weatherapi. And add the API key in generic credentials type > query auth > Name: key & value: your-api-key

  3. Get a Gemini API

Here is the node by node explanation:

Part 1: The Climate-Driven Lead Generation Engine (Proactive Outreach)

This first sub-workflow is the proactive "scraper." It constantly monitors your CRM contacts and cross-references their locations with live weather data to trigger the upsell campaigns.

1. Schedule Trigger & Fetch Contacts

  • Every Morning at 7am (Schedule Trigger): Kicks off the workflow daily.
  • Fetch Contacts (HighLevel): Pulls down your entire list of old customers/leads from GoHighLevel.

2. Geocoding & Data Cleaning

  • If City Set (If Node): Checks if the CRM contact already has a city populated.
  • Loop Over Contacts & Fetch City (Nominatim API): If a city is missing, it runs the address through the Nominatim OpenStreetMap API to extract the exact city, then uses a GHL node to Update Contact City so we don't have to geocode them again in the future.

3. Weather Data Aggregation

  • Group Contacts by City (Code Node): A crucial step to save on API calls. Instead of calling the weather API 1,000 times for 1,000 contacts, this custom JS groups all contacts by their city.
  • Fetch Weather Forecast (HTTP Request): Pings WeatherAPI.com to grab the 5-day forecast for each unique city.

4. Hazard Detection & Routing

  • Detect Weather Hazards (Code Node): This is where the magic happens. A script checks the upcoming 5-day forecast against dynamic, seasonal temperature thresholds (e.g., a "heatwave" in May is >85°F, but in August it might be >95°F). It tags the grouped contacts with a campaign_type (HEATWAVE or FREEZE).
  • Check Campaign Type (If Node): Routes the qualified leads into either the Heatwave or Snowwave pipeline logic.

5. CRM Execution & WhatsApp Outreach

  • Create Template Opportunity (HighLevel): Drops the lead into the "New Lead" stage of the respective GHL pipeline.
  • Send WhatsApp Template (WhatsApp): Fires off the pre-approved Meta marketing template (the helpful Do's and Don'ts checklist) to the customer.
  • Update & Upsert (HighLevel): Moves the Opportunity to the "Contacted" stage and updates the contact's custom field (opp_type) so the system remembers why we reached out.

Part 2: The AI-Powered Service Concierge (Inbound Handling)

When a customer replies to that WhatsApp blast saying something like "Yeah, my AC is making a weird noise, can someone come out?", this second sub-workflow takes over to autonomously book the appointment.

1. Trigger & Validation

  • When WhatsApp Message Received (Trigger): Listens for inbound replies from customers.
  • Fetch GHL Contacts & Check Existence: Looks up the sender's phone number in GoHighLevel to ensure they are a known contact. If they aren't in the system, it ignores them.

2. The Opt-Out Filter

  • If Stop Command Received: Looks for the keyword "STOP".
  • Upsert GHL Contact: If they replied STOP, it immediately updates their stop_whatsapp custom field to TRUE so they are excluded from future blasts, terminating the flow.

3. The Agentic Core

  • Customer Service AI Agent (LangChain): If the user is asking for help, the message is routed to an AI Agent powered by the Gemini Chat Model.
  • Redis Chat History Memory: Plugs into a Redis instance so the agent remembers the context of the conversation (vital for back-and-forth scheduling).
  • Agent Tools: The Gemini agent is equipped with several powerful HighLevel tools it can trigger on its own:
    • Fetch Available Calendar Slots: The AI is strictly instructed to check live GHL availability before suggesting times.
    • Book Calendar Appointment: Automatically secures the slot if the user agrees.
    • Close Deal Tools: If the user says "I'm good, no thanks", the AI triggers the "Close Heatwave/Snowwave Deal" tool to mark the CRM opportunity as lost.
    • Check/Scheduled Tools: If an appointment is booked, the AI moves the pipeline stage to "Scheduled" without needing manual intervention.

4. Final Response

  • Send WhatsApp Response (WhatsApp): The AI formulates a conversational, friendly reply (styled with WhatsApp formatting like bolding and bullet points) and sends it right back to the customer.
youtu.be
u/Charming_You_8285 — 9 days ago
▲ 7 r/n8n

I built a weather based Upsell for HVAC businesses with Gohighlevel + whatsapp

Hi, I am Vaar an automation dev just like most of you here 😄

Workflow Code Link: https://gist.github.com/iamvaar-dev/e1b968be2ee1bf5c3bbf4e5c4f1ea2f9

This project is specifically built for a HVAC business where the system automatically upsell to old customers when thier locality have any heat wave or snow wave forecast in the upcomming 5 days.

Firstly pre-requesties:

  1. Gohighlevel:
  2. - Create Custome Fields: a. stop_whatsapp[used when user replied STOP to remove from the marketing list] b. opp_type[heatwave or snowwave]
  3. - Create two pipelines: a:HEATWAVE, b: SNOWWAVE and both pipelines will have 4 stages i.e new lead, contacted, scheduled, closed

- Grab the calender id in Gohighlevel with you as it will be needed in the workflow to look for free slots and books an appointment.

  1. Whatsapp:
    - Create a marketing template in meta business suite for heatwave & snowwave:
    a. Heatwave:
    Hello {{1}},

With temperatures expected to rise soon, we wanted to share a few tips to keep your home comfortable and your AC running efficiently.

Maintenance Tips:
• Keep blinds closed during peak sun hours.
• Check your air filters; a clean filter prevents overworking.
• If you leave the house, raise the thermostat a few degrees rather than turning it off.

Need help?
If your system is struggling to keep up, we are here to assist.

Stay cool and safe!

b. Snow wave:

Hello {{1}},

With a cold front and freezing temperatures expected soon, we wanted to share a few tips to keep your home warm and your heating system running efficiently.

Winter Comfort Tips:
• Keep curtains and blinds open during the day to let sunlight naturally warm your home, then close them at night to trap the heat.
• Check your air filters; a clogged filter makes your heater work much harder in freezing weather.
• Ensure your outdoor vents and heat pump units are clear of snow or debris to maintain proper airflow.

Need help?
If your heating system is struggling to stay warm or making unusual noises, we are here to assist.

Stay warm and safe!

  1. Read Nominatim openstreet API Docs[which we use it for city extraction from address]
    and thanks a lot for the Nominatim contributors for keeping the project opensource.

  2. Get a free api from weatherapi. And add the API key in generic credentials type > query auth > Name: key & value: your-api-key

  3. Get a Gemini API

Here is the node by node explanation:

Part 1: The Climate-Driven Lead Generation Engine (Proactive Outreach)

This first sub-workflow is the proactive "scraper." It constantly monitors your CRM contacts and cross-references their locations with live weather data to trigger the upsell campaigns.

1. Schedule Trigger & Fetch Contacts

  • Every Morning at 7am (Schedule Trigger): Kicks off the workflow daily.
  • Fetch Contacts (HighLevel): Pulls down your entire list of old customers/leads from GoHighLevel.

2. Geocoding & Data Cleaning

  • If City Set (If Node): Checks if the CRM contact already has a city populated.
  • Loop Over Contacts & Fetch City (Nominatim API): If a city is missing, it runs the address through the Nominatim OpenStreetMap API to extract the exact city, then uses a GHL node to Update Contact City so we don't have to geocode them again in the future.

3. Weather Data Aggregation

  • Group Contacts by City (Code Node): A crucial step to save on API calls. Instead of calling the weather API 1,000 times for 1,000 contacts, this custom JS groups all contacts by their city.
  • Fetch Weather Forecast (HTTP Request): Pings WeatherAPI.com to grab the 5-day forecast for each unique city.

4. Hazard Detection & Routing

  • Detect Weather Hazards (Code Node): This is where the magic happens. A script checks the upcoming 5-day forecast against dynamic, seasonal temperature thresholds (e.g., a "heatwave" in May is >85°F, but in August it might be >95°F). It tags the grouped contacts with a campaign_type (HEATWAVE or FREEZE).
  • Check Campaign Type (If Node): Routes the qualified leads into either the Heatwave or Snowwave pipeline logic.

5. CRM Execution & WhatsApp Outreach

  • Create Template Opportunity (HighLevel): Drops the lead into the "New Lead" stage of the respective GHL pipeline.
  • Send WhatsApp Template (WhatsApp): Fires off the pre-approved Meta marketing template (the helpful Do's and Don'ts checklist) to the customer.
  • Update & Upsert (HighLevel): Moves the Opportunity to the "Contacted" stage and updates the contact's custom field (opp_type) so the system remembers why we reached out.

Part 2: The AI-Powered Service Concierge (Inbound Handling)

When a customer replies to that WhatsApp blast saying something like "Yeah, my AC is making a weird noise, can someone come out?", this second sub-workflow takes over to autonomously book the appointment.

1. Trigger & Validation

  • When WhatsApp Message Received (Trigger): Listens for inbound replies from customers.
  • Fetch GHL Contacts & Check Existence: Looks up the sender's phone number in GoHighLevel to ensure they are a known contact. If they aren't in the system, it ignores them.

2. The Opt-Out Filter

  • If Stop Command Received: Looks for the keyword "STOP".
  • Upsert GHL Contact: If they replied STOP, it immediately updates their stop_whatsapp custom field to TRUE so they are excluded from future blasts, terminating the flow.

3. The Agentic Core

  • Customer Service AI Agent (LangChain): If the user is asking for help, the message is routed to an AI Agent powered by the Gemini Chat Model.
  • Redis Chat History Memory: Plugs into a Redis instance so the agent remembers the context of the conversation (vital for back-and-forth scheduling).
  • Agent Tools: The Gemini agent is equipped with several powerful HighLevel tools it can trigger on its own:
    • Fetch Available Calendar Slots: The AI is strictly instructed to check live GHL availability before suggesting times.
    • Book Calendar Appointment: Automatically secures the slot if the user agrees.
    • Close Deal Tools: If the user says "I'm good, no thanks", the AI triggers the "Close Heatwave/Snowwave Deal" tool to mark the CRM opportunity as lost.
    • Check/Scheduled Tools: If an appointment is booked, the AI moves the pipeline stage to "Scheduled" without needing manual intervention.

4. Final Response

  • Send WhatsApp Response (WhatsApp): The AI formulates a conversational, friendly reply (styled with WhatsApp formatting like bolding and bullet points) and sends it right back to the customer.
u/Charming_You_8285 — 11 days ago