Postgres workflows
14 results — all source-linked n8n references
Publish scheduled LinkedIn posts from Twenty CRM via Unipile and SharePoint
Quick overview Automate your LinkedIn content calendar. This workflow fetches scheduled posts from a PostgreSQL database (Twenty CRM), downloads attached media from SharePoint, and publishes them seamlessly to LinkedIn using Unipile. How it works A Schedule Trigger (Cron) fires every 5 minutes to check for pending social media posts A PostgreSQL node queries the database to fetch posts marked as 'SCHEDULED' where the scheduled time has passed. A Split In Batches node loops through the fetched posts one by one to prevent API concurrency issues. An IF node checks if there is a SharePoint attachment URL included in the database record. If an attachment exists, Microsoft Graph API nodes resolve the SharePoint Drive Item and download the image as a binary file HTTP Request nodes send the text (and binary attachment, if any) to Unipile's API to natively publish the LinkedIn post. A final PostgreSQL node updates the CRM record to 'POSTED' and saves the live LinkedIn post URL back to the database. Setup Add your PostgreSQL credentials and verify that the SQL query matches your Twenty CRM table and schema names. Connect your Microsoft Entra ID (Azure AD) account to authenticate SharePoint a
Route human-in-the-loop approval requests with Slack and Postgres
Quick overview This workflow exposes a single webhook that either accepts new approval requests or handles Slack button callbacks, posting interactive Slack Block Kit messages and recording decisions in a PostgreSQL table. How it works Receives a POST request on a webhook endpoint that serves as both the intake API and the Slack interactivity callback URL. Validates the Slack request signature and timestamp when the request includes Slack signature headers. Routes the request by detecting whether it contains a URL-encoded Slack payload (callback) or a custom intake body (new request). For intake requests, builds a Slack Block Kit approval message with Approve/Reject/Flag buttons and posts it to Slack. Stores the request context, Slack channel ID, and message timestamp in PostgreSQL and returns a 200 response with the generated requestId. For Slack button callbacks, immediately returns a 200 response to Slack, looks up the request context in PostgreSQL, and merges it with the callback details. Updates the original Slack message to replace buttons with a static decision status and writes the decision (approved/rejected/flagged) back to PostgreSQL. Setup Create the approval_requests t
Import CSV files from Filesystem into Postgres
-- Disclaimer: This template is mainly made for self-hosted users who can reach CSV files in their file system. For Cloud users, just replace the first few nodes with your file system of choice, like Google Drive or Dropbox -- How to automatically import CSV files into postgres 1、project description This workflow demonstrates how CSV file can be automatically imported into existing PostgreSQL database. Before running the workflow please make sure you have a file on the server: /tmp/t1.csv The name of the test database is db01, and you can replace it. then create table t1 create table t1(id int,name varchar(10)); And the content of the file is the following: |id|name| |-|-|-| |1|a| |2|b| |3|c| 2、Other If you want to import a custom csv file, please refer to the following methods. 2.1、Create a table in the database SQL Commands: https://www.postgresql.org/docs/current/sql-createtable.html 2.2、Upload csv file Upload csv file to N8N server and make sure it can be read.
Youtube Outlier Detector (Find trending content based on your competitors)
Video explanation This n8n workflow helps you identify trending videos within your niche by detecting outlier videos that significantly outperform a channel's average views. It automates the process of monitoring competitor channels, saving time and streamlining content research. Included in the Workflow Automated Competitor Video Tracking Monitors videos from specified competitor channels, fetching data directly from the YouTube API. Outlier Detection Based on Channel Averages Compares each video’s performance against the channel’s historical average to identify significant spikes in viewership. Historical Video Data Management Stores video statistics in a PostgreSQL database, allowing the workflow to only fetch new videos and optimize API usage. Short Video Filtering Automatically removes short videos based on duration thresholds. Flexible Video Retrieval Fetches up to 3 months of historical data on the first run and only new videos on subsequent runs. PostgreSQL Database Integration Includes SQL queries for database setup, video insertion, and performance analysis. Configurable Outlier Threshold Focuses on videos published within the last two weeks with view counts at least twic
Enrich up to 1500 emails per hour with Dropcontact batch requests
The template allows to make Dropcontact batch requests up to 250 requests every 10 minutes (1500/hour). Valuable if high volume email enrichment is expected. Dropcontact will look for email & basic email qualification if first_name, last_name, company_name is provided. +++++++++++++++++++++++++++++++++++++++++ Step 1: Node "Profiles Query" Connect your own source (Airtable, Google Sheets, Supabase,...) the template is using Postgres by default. Note I: Be careful your source is only returning a maximum of 250 items. Note II: The next node uses the next variables, make sure you can map these from your source file: first_name last_name website (company_name would work too) full_name (see note) Note III: This template is using the Dropcontact Batch API, which works in a POST & GET setup. Not a GET request only to retrieve data, as Dropcontact needs to process the batch data load properly. +++++++++++++++++++++++++++++++++++++++++ Step 2: Node "Data Transformation" Will transform the input variables in the proper json format. This json format is expected from the Dropcontact API to make a batch request. "full_name" is being used as a custom identifier to update the returned email to th
Watchdog: Update All Workflows With Default Error Workflow
Do you consistently forget to set a Default Error Workflow when creating new workflows? Then this helper workflow is for you! When activated, this helper workflow will: Scan ALL other workflows every 4 hours Make sure ALL workflows have a default error workflow set (based on what Workflow ID you provide) This helper will SKIP OVER any workflows that have the default_error:false tag set (make sure your default error workflow has the default_error:false tag set, so that you don't end up with recursive loops during errors) Setup Nodes: Once imported, edit the Set Vars node with your default_error_workflow_id value. If you want to change the default_error:false tag to some other tag name, you can do so here as well. You need to update the Set Default Error Workflow node with your PostgreSQL credentials to access the n8n database.
🤖 Advanced Slackbot with n8n
Use case Slackbots are super powerful. At n8n, we have been using them to get a lot done.. But it can become hard to manage and maintain many different operations that a workflow can do. This is the base workflow we use for our most powerful internal Slackbots. They handle a lot from running e2e tests for Github branch to deleting a user. By splitting the workflow into many subworkflows, we are able to handle each command seperately, making it easier to debug as well as support new usecases. In this template, you can find eveything to setup your own Slackbot (and I made it simple, there's only one node to configure 😉). After that, you need to build your commands directly. This bot can create a new thread on an alerts channel and respond there. Or reply directly to the user. It responds for help request to return a help page. It automatically handles unknown commands. It also supports flags and environment variables. For example /cloudbot-test info mutasem --full-info -e env=prod would give you the following info, when calling subworkflow. How to setup Add Slack command and point it up to the webhook. For example. Add the following to the Set config node alerts_channel with alerts
Convert PostgreSQL table to CSV
Convert PostgreSQL table to CSV CSV is a super useful and universal way to transfer data between different tools. This workflow gives an example of how to take data from PostgreSQL and convert it easily into a CSV. What you need Before running the workflow, please make sure you have access to a remote PostgreSQL server and have table data: book_title,book_author,read_date Demons,Fyodor Dostoyevsky,2022-09-08 Ulysses,James Joyce,2022-05-06 Catch-22,Joseph Heller,2023-01-04 The Bell Jar,Sylvia Plath,2023-01-21 Frankenstein,Mary Shelley,2023-02-14 How it works Trigger the workflow on click Declare the name of the Excel file and sheet names Remotely connect to the PostgreSQL database and specify query execution Write the query data to CSV The detailed process is explained further in the tutorial: https://blog.n8n.io/postgres-export-to-csv/
Create a table in Postgres and insert data
Companion workflow for Postgres node docs
Run a SQL query on Postgres
Companion Workflow for Postgres node docs
Send SMS alerts based on database queries (Twilio and Postgres)
This workflow automatically queries a Postgres database to find outlier readings for which SMS notifications have not been sent. This is Workflow 2 in the blog tutorial Database activity monitoring and alerting. Prerequisites A Postgres database set up and credentials A Twilio account and credentials Nodes Cron node triggers the workflow every minute, so the database is queried at regular intervals. Postgres nodes extract values from, and update values in the database. Twilio node sends an alert SMS about the outlier reading to a specified phone number. Set node sets the notification value to true.
Generate and insert data into a Postgres database
This is Workflow 1 in the blog tutorial Database activity monitoring and alerting. Prerequisites A Postgres database set up and credentials. Basic knowledge of JavaScript and SQL. Nodes Cron node starts the workflow every minute. Function node generates sensor data (sensor id (preset), a randomly generated value, timestamp, and notification (preset as false) ) Postgres node inserts the data into a Postgres database. You can create the database for this workflow with the following SQL statement: CREATE TABLE n8n (id SERIAL, sensor_id VARCHAR, value INT, time_stamp TIMESTAMP, notification BOOLEAN);
Transfer data from Postgres to Excel
Read data from Postgres Converting it to XLS Save it to disk
Insert Excel data to Postgres
Read XLS from file Convert it to JSON Insert it in Postgres