Custom URL Shortener with Airtable and n8n
detail.loadingPreview
Instantly create and manage custom short URLs with this powerful n8n workflow. Leveraging Airtable as your backend database, you can generate unique short links on demand and handle redirection, all without extensive coding.
About This Workflow
Tired of generic URL shorteners or complex self-hosted solutions? This n8n workflow provides a robust, customizable URL shortening service using Airtable. When a long URL is submitted via a webhook, it automatically generates a unique 6-character ID (based on an SHA256 hash), creates a corresponding short URL, and stores all details in your Airtable base. If the URL (and thus its ID) already exists, it intelligently returns the existing short link. For redirection, a separate webhook handles incoming short links, retrieves the original URL from Airtable, and prepares for redirection, ensuring seamless link management and laying the groundwork for click tracking.
Key Features
- Custom Short URL Generation: Automatically creates unique, 6-character short IDs for any long URL, based on an SHA256 hash for consistency.
- Airtable Integration: Stores all shortened URLs, original links, and metadata securely in your Airtable base.
- Webhook-Triggered Creation: Easily integrate link creation into other systems via a simple HTTP POST or GET request with a
urlparameter. - Efficient Redirection Handler: Processes incoming short links (e.g.,
your_n8n_url/go?id=XYZ) to retrieve the original URL for redirection. - Duplicate Prevention: Checks for existing short IDs in Airtable to avoid collisions and ensures consistent links for the same long URL.
How To Use
- Set up your Airtable Base: Create a new base and a table (e.g., "Shortened Links"). Define the following fields:
id(Single line text),longUrl(URL),shortUrl(URL),host(Single line text), andclicks(Number - optional, for future click tracking). - Configure Webhooks:
- For the "Webhook" node, set the
pathto your desired endpoint for shortening (e.g.,sh). - For the "Webhook1" node, set the
pathto your desired redirection endpoint (e.g.,/go).
- For the "Webhook" node, set the
- Update Airtable Credentials: In both "Airtable" nodes ("Airtable" and "Find by ID1"), replace
YOUR TABLE NAMEandYOUR BASE IDwith your actual Airtable table name and base ID. Ensure your Airtable API credentials are correctly configured in n8n. - Customize Short URL Domain (Optional): In the "Set ID,shortUrl,longUrl" node, modify the
shortUrlexpressionhttp://n8n.ly/w/go?id={{$node["Crypto"].json["data"].substr(0,6)}}to use your preferred custom domain or n8n URL (e.g.,https://yourdomain.com/go?id=). - Activate and Test: Save and activate the workflow. Send a POST or GET request to your
shwebhook with aurlquery parameter (e.g.,YOUR_N8N_URL/webhook/sh?url=https://example.com/long/path). Test the generated short URL by navigating to it.
Apps Used
Workflow JSON
{
"id": "1ddb732d-40d0-43f2-9bdc-eeb73378c049",
"name": "Custom URL Shortener with Airtable and n8n",
"nodes": 19,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 1ddb732d-40d0...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Google Sheets to Icypeas: Automated Bulk Domain Scanning
This workflow streamlines the process of performing bulk domain scans by integrating your Google Sheets data directly with the Icypeas platform. Automate the submission of company names from your spreadsheet to Icypeas for comprehensive domain information, saving valuable time and effort.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.