Skip to content

n8n Integration

n8n is a workflow automation tool that is highly customizable and can be self-hosted. It is excellent for handling webhook events from TBT and processing them with complex logic.

Prerequisites

  • An n8n instance (Cloud or Self-hosted).
  • Your TBT Operator account needs to be configured with the n8n Webhook URL.

Setup Guide

1. Create a New Workflow

  1. Open your n8n editor.
  2. Click "Add first step".

2. Add the Webhook Node

  1. Search for "Webhook".
  2. Select the Webhook trigger node.

3. Configure the Webhook Node

  1. Authentication: Select "None" (unless you have arranged specific header auth with TBT support).
  2. HTTP Method: Select POST.
  3. Path: You can leave it as default or give it a name like tbt-booking.
  4. Respond: "Immediately" is recommended.

4. Get Your Webhook URL

n8n provides two URLs: Test and Production.

  1. Test URL: Used while building the workflow.
    • Example: https://your-n8n-instance.com/webhook-test/tbt-booking
  2. Production URL: Used when the workflow is active.
    • Example: https://your-n8n-instance.com/webhook/tbt-booking

Note: Initially, you might want to provide the Production URL to TBT support so your live automation works immediately after activation. If you want to debug first, you can use the Test URL, but you will need to keep the n8n UI open and listening.

5. Connect to TBT

  1. Email [email protected].
  2. Subject: "Add Operator Webhook URL".
  3. Body: Please set my operator webhook URL to: [Paste your n8n Production URL here].

6. Test the Workflow

  1. In n8n, click "Listen for Test Event".
  2. Wait for a booking to occur on TBT, or ask TBT support to send a test payload to your Test URL (you would need to temporarily update the URL with TBT support or simulate the POST request yourself using Postman/cURL).
  3. Once received, you will see the JSON structure in the output data.

7. Add Processing Nodes

You can now connect other nodes to process the booking data.

Example: Filter by Route

  1. Add an "If" node.
  2. Condition: {{ $json.body.payload.booking.route_name }} contains "Phuket".
  3. Connect true/false outputs to different actions (e.g., send Slack message vs. Email).

8. Activate

  1. Toggle the "Active" switch in the top right corner of n8n.
  2. Ensure TBT has your Production URL configured.

Your n8n workflow will now process every new booking automatically.