Generate and Manage Short Links with GPT-4.1 and Data Storage

Go to Workflow
1 views
Built by Nghia Nguyen Nghia Nguyen
Created on June 05, 2026

Description

This AI Agent helps you create short links from your original URLs.
Each generated short link is automatically stored in a database table for easy management and tracking.

How It Works

Provide a long URL to the Agent.
The Agent saves your original link in the database.
It generates a short link in the following format:

Short link: https://{webhook_url}/webhook/shortLink?q={shortLinkId}

When users open the short link, they are automatically redirected to your original link.

How to Use

Send your link to the Agent.
The Agent will respond with a generated short link.

Requirements

Add your your_webhook_url to the Config Node.
OpenAI account
Create a database table named ShortLink with the following columns:

| Column Name | Description |
|----------------|------------------------------|
| originalLink | Stores the full original URL. |
| shortLinkId | Stores the unique short link ID. |

Customization Options

Add traffic tracking or analytics for each short link.
Customize the redirect page to display your logo, message, or branding.

Nodes Used (6)

AI Agent
@n8n/n8n-nodes-langchain.agent
Call n8n Workflow Tool
@n8n/n8n-nodes-langchain.toolWorkflow
Code
n8n-nodes-base.code
HTML
n8n-nodes-base.html
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow