Generate and Manage Short Links with GPT-4.1 and Data Storage — n8n Workflow

Medium complexity Trigger14 nodes🏷️ Miscellaneous👁 1 viewsby Nghia Nguyen

Overview

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

Nodes used

CodeHTMLAI AgentOpenAI Chat ModelSimple MemoryCall n8n Workflow Tool

Workflow Preview

Setup Guide
1. Add your_webhook_url to the 'Config' Node.
2. Set up OpenAI account
3. Create a database table named ShortLink with the fol
- originalLink
- shortLinkId
Agent
Create Short Link
Process Short Link Requests
memorymodeltool
I
Insert row
Generate shorlinkId
G
Get row(s)
W
When chat message received
AI Agent
OpenAI Chat Model
Simple Memory
G
GenerateShortLink
C
Config
Generate ShortLink
Call 'Create Short Link'
Page Redirect
R
Response
S
ShortLink API
14 nodes11 edges

How it Works

  1. 1

    Trigger

    The workflow starts with a trigger trigger.

  2. 2

    Process

    Data flows through 14 nodes, connecting agent, chattrigger, code.

  3. 3

    Output

    The workflow completes its automation and delivers the result to the configured destination.

Node Details (14)

CO

Code

code

#1
HT

HTML

html

#2
AI

AI Agent

n8n-nodes-langchain.agent

#3
OP

OpenAI Chat Model

n8n-nodes-langchain.lmChatOpenAi

#4
SI

Simple Memory

n8n-nodes-langchain.memoryBufferWindow

#5
CA

Call n8n Workflow Tool

n8n-nodes-langchain.toolWorkflow

#6

How to Import This Workflow

  1. 1Click Download JSON button on the right to save the workflow file.
  2. 2Open your n8n instance. Go to Workflows → New → Import from file.
  3. 3Select the downloaded generate-and-manage-short-links-with-gpt-41-and-data-storage file and click Import.
  4. 4Set up credentials for each service node (API keys, OAuth, etc.).
  5. 5Click Test Workflow to verify everything works, then activate it.

Or paste directly in n8n → Import from JSON:

{ "name": "Generate and Manage Short Links with GPT-4.1 and Data Storage", "nodes": [...], ...}

Integrations

agentchattriggercodedatatableexecuteworkflowtriggerhtmllmchatopenaimemorybufferwindowrespondtowebhooksettoolworkflowwebhook

Get This Workflow

Download and import in one click

Download JSONView on n8n.io
Nodes14
Complexitymedium
Triggertrigger
Views1

Created by

Nghia Nguyen

Nghia Nguyen

@nghiaaidev

Tags

agentchattriggercodedatatableexecuteworkflowtriggerhtmllmchatopenaimemorybufferwindowrespondtowebhookset

New to n8n?

n8n is a free, open-source workflow automation tool. Self-host it or use the cloud version.

Get n8n Free →

Related Miscellaneous Workflows