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: SQL CREATE TABLE n8n (id SERIAL, sensorid VARCHAR, value INT, timestamp TIMESTAMP, notification BOOLEAN);
🏛️ Daily US Congress members stock trades report via Firecrawl + OpenAI + Gmail
📬 What This Workflow Does This workflow automatically scrapes recent high-value congressional stock trades from Quiver Quantitative, summarizes the key transactions, and delivers a neatly formatted report to your inbox — every single day. It combines Firecrawl's powerful content extraction, OpenAI's GPT formatting, and n8n's automation engine to turn raw HTML data into a digestible, human-readable email. Watch Full Tutorial on how to build this workflow here: https://www.youtube.com/watch?v=HChQSYsWbGo&t=947s&pp=0gcJCb4JAYcqIYzv 🔧 How It Works 🕒 Schedule Trigger Fires daily at a set hour (e.g., 6 PM) to begin the data pipeline. 🔥 Firecrawl Extract API (POST) Targets the Quiver Quantitative “Congress Trading” page and sends a structured prompt asking for all trades over $50K in the past month. ⏳ Wait Node Allows time for Firecrawl to finish processing before retrieving results. 📥 Firecrawl Get Result API (GET) Retrieves the extracted and structured data. 🧠 OpenAI Chat Model (GPT-4o) Formats the raw trading data into a readable summary that includes: Date of Transaction Stock/Asset traded Amount Congress member’s name and political party 📧 Gmail Node Sends the summary to your inbox with the subject “Congress Trade Updates - QQ”. 🧠 Why This is Useful Congressional trading activity often reveals valuable signals — especially when high-value trades are made. This workflow: Saves time manually tracking Quiver Quant updates Converts complex tables into a daily, readable email Keeps investors, researchers, and newsrooms in the loop — hands-free 🛠 Requirements Firecrawl API Key (with extract access) OpenAI API Key Gmail OAuth2 credentials n8n (self-hosted or cloud) 💬 Sample Output: Congress Trade Summary – May 21 Nancy Pelosi (D) sold TSLA for $85,000 on April 28 John Raynor (R) purchased AAPL worth $120,000 on May 2 ... and more 🪜 Setup Steps Add your Firecrawl, OpenAI, and Gmail credentials in n8n. Adjust the schedule node to your desired time. Customize the OpenAI system prompt if you want a different summary style. Deploy the workflow — and enjoy your daily edge.
AI-powered personal assistant for Telegram with memory & task management
Telegram AI Assistant with Memory, Tasks, and Live Search (Airtable + Google Calendar) This workflow creates an intelligent Telegram-based AI assistant that remembers user details, manages lists, integrates with Google Calendar, and can fetch live information from the web. It is designed for everyday use and improves over time with your feedback. What It Does Personal Memory: Saves user preferences and instructions in Airtable. Task & Grocery Lists: Add, search, or delete grocery and to-do items directly in Telegram. Calendar Management: Create, update, delete, and search events (single or recurring) with Google Calendar. Voice Support: Send voice messages—these are transcribed and processed like text. Web Search: (Optional) Fetch real-time answers using SerpAPI. --- Prerequisites n8n (Cloud or self-hosted instance). Telegram Bot (create via @BotFather on Telegram). Airtable account with a new Base containing 3 tables: User Memory Grocery's To Do List Google Account with Calendar enabled (for OAuth2). OpenAI API Key (for AI responses + voice transcription). SerpAPI Key (optional, for live web search). --- Airtable Schema Inside your new Airtable Base, create the following tables and fields: User Memory Memory (text) User (text) Time (created time) Grocery's Item (text) User (text) Created (created time) To Do List Task (text) Project or Class (text) User (text) Created (created time) > Field names must match exactly. --- Setup Instructions Import the workflow JSON into n8n. Configure credentials for each service in the workflow: Telegram API → Paste in your bot token. Airtable → Add your Airtable personal access token. After this, Airtable nodes will show dropdowns where you can select your Base and then your Tables (no need to paste IDs). Google Calendar → Connect your Google account. Once credentials are added, simply pick your Calendar from the dropdown (e.g., “primary” or any shared calendar). OpenAI → Add your API key for chat + voice transcription. SerpAPI → Add your API key (optional). For Telegram Trigger: Click “Listen for Test Event” and send a message to your bot to register the webhook. In group chats: disable privacy mode in @BotFather so the bot can see all messages. Activate the workflow and start chatting with your bot. --- How to Use Memory “Remember my coffee order is oat milk latte.” “Keep replies shorter.” Grocery List “Add eggs.” → “Added eggs.” “What’s on my grocery list?” → Lists all items “Remove bread.” → “Removed bread.” To-Do List “Add finish report for work.” “What’s on my to-do list?” “Remove finish report.” Calendar “Create event ‘Team sync’ tomorrow 3–4 pm.” “Make a recurring study session every Friday at 2 pm.” “Delete the dentist appointment at 4 pm.” Web Search “Get news.” → Summarizes top 5–6 stories from the past 24 hours. --- Configuration Notes You don’t need to enter Airtable IDs or Calendar IDs manually — just use the dropdowns after credentials are set up. Airtable “User” field is filled automatically with the Telegram username. Voice messages are downloaded and transcribed by OpenAI before being processed as text. --- Security All API keys and tokens are stored securely in n8n Credentials. No hard-coded IDs, emails, or secrets in this template. Webhook IDs are not included; n8n generates them automatically on import. --- Troubleshooting Bot not responding? Ensure the workflow is active, Telegram Trigger is listening, and bot privacy settings are configured for groups. Airtable errors? Check that your base and tables exist, and that field names match exactly. Calendar issues? Confirm the Google account has access to the selected calendar. Voice transcription failing? Verify your OpenAI credentials and Telegram bot permissions. --- Why This Template Works for Everyone Uses dropdown selections for Airtable and Google Calendar (no IDs needed). Includes clear setup instructions. Credentials are handled securely through n8n. Flexible: works with groceries, tasks, memory, calendar, and optional live web search.