This workflow follows the Gmail → Postgres recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "AEJaCA \u2014 Newsletter Signup (10% discount)",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "newsletter-signup",
"responseMode": "responseNode",
"options": {
"allowedOrigins": "https://www.aejaca.com"
}
},
"id": "webhook-newsletter",
"name": "Webhook \u2014 Newsletter",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
200,
300
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={ {\"ok\": true} }",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Access-Control-Allow-Origin",
"value": "https://www.aejaca.com"
}
]
}
}
},
"id": "respond-ok",
"name": "Respond OK",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
420,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": false
},
"combinator": "and",
"conditions": [
{
"id": "email-check",
"leftValue": "={{ $json.body.email }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "isNotEmpty"
}
}
]
}
},
"id": "validate-email",
"name": "Validate Email",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
640,
300
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO subscribers (email, lang, source) VALUES ('{{ $json.body.email }}', '{{ $json.body.lang }}', '{{ $json.body.source || \"footer\" }}') ON CONFLICT (email) DO UPDATE SET lang = EXCLUDED.lang, unsubscribed = FALSE",
"options": {}
},
"id": "save-subscriber",
"name": "Save to PostgreSQL",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.5,
"position": [
860,
200
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"sendTo": "={{ $json.body.email }}",
"subject": "={{ $json.body.lang === 'de' ? 'Dein 10% Rabattcode von AEJaCA' : $json.body.lang === 'en' ? 'Your 10% discount code from AEJaCA' : 'Tw\u00f3j kod 10% zni\u017cki od AEJaCA' }}",
"message": "",
"options": {
"appendAttribution": false,
"replyTo": "contact@aejaca.com"
}
},
"id": "send-welcome",
"name": "Send Welcome + Discount",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
860,
400
],
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"notesInFlow": true,
"notes": "Paste HTML from n8n/emails/newsletter-welcome.html"
},
{
"parameters": {
"sendTo": "contact@aejaca.com",
"subject": "=\ud83d\udcec Nowy subskrybent: {{ $json.body.email }} ({{ $json.body.lang }})",
"message": "=<p><b>Nowy subskrybent newslettera</b></p><p>Email: {{ $json.body.email }}<br>J\u0119zyk: {{ $json.body.lang }}<br>\u0179r\u00f3d\u0142o: {{ $json.body.source || 'footer' }}<br>Czas: {{ $json.body.ts }}</p>",
"options": {
"appendAttribution": false
}
},
"id": "notify-owner",
"name": "Notify Owner",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
860,
600
],
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Webhook \u2014 Newsletter": {
"main": [
[
{
"node": "Respond OK",
"type": "main",
"index": 0
}
]
]
},
"Respond OK": {
"main": [
[
{
"node": "Validate Email",
"type": "main",
"index": 0
}
]
]
},
"Validate Email": {
"main": [
[
{
"node": "Save to PostgreSQL",
"type": "main",
"index": 0
},
{
"node": "Send Welcome + Discount",
"type": "main",
"index": 0
},
{
"node": "Notify Owner",
"type": "main",
"index": 0
}
],
[]
]
}
},
"settings": {
"executionOrder": "v1"
},
"tags": [
{
"name": "AEJaCA",
"id": "1"
},
{
"name": "Newsletter",
"id": "3"
}
]
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2postgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
AEJaCA — Newsletter Signup (10% discount). Uses postgres, gmail. Webhook trigger; 6 nodes.
Source: https://github.com/ArturHebenstreit/aejaca-site/blob/c3362d09d9aa7423c552061ec341637fb28460bf/n8n/newsletter-workflow.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Suspicious_login_detection. Uses postgres, httpRequest, noOp, html. Webhook trigger; 43 nodes.
This n8n workflow is designed for security monitoring and incident response when suspicious login events are detected. It can be initiated either manually from within the n8n UI for testing or automat
Workflow1-2-3. Uses httpRequest, gmail, telegram, postgres. Webhook trigger; 34 nodes.
Customer Onboarding Pipeline. Uses httpRequest, postgres, slack, gmail. Webhook trigger; 13 nodes.
email-handler-new. Uses gmail, gmailTrigger, postgres. Webhook trigger; 10 nodes.