Skip to main content

Monitor Facebook post safety with Apify, Google Gemini and Telegram alerts

Workflow preview

Workflow preview
100%
Monitor Facebook post safety with Apify, Google Gemini and Telegram alerts preview
Open on n8n.io

1. Workflow Overview

Monitor Facebook Pages and Analyze Content Safety via Telegram This n8n template automates the collection, storage, and safety analysis ...

Best for

  • Ticket Management automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegramtrigger, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.telegram, @n8n/n8n-nodes-langchain.memorymongodbchat, n8n-nodes-serpapi.serpapitool, @n8n/n8n-nodes-langchain.toolworkflow, n8n-nodes-base.scheduletrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Nguyễn Thiệu Toàn (Jay Nguyen).

Original n8n.io source

1.1 Workflow description

Title
Monitor Facebook post safety with Apify, Google Gemini and Telegram alerts
Workflow name
Monitor Facebook post safety with Apify, Google Gemini and Telegram alerts

Monitor Facebook Pages and Analyze Content Safety via Telegram

This n8n template automates the collection, storage, and safety analysis of Facebook posts while simultaneously providing an interactive AI assistant on Telegram.

If you manage communities or brand pages and need to stay instantly informed about toxic content while having a smart assistant to answer quick operational queries, this workflow is perfect for you.

How it works

  • Interactive Chatbot (Trigger): The Telegram Trigger listens for direct messages. An AI Agent (powered by Google Gemini) processes the input using MongoDB for conversation memory and custom tools (like SerpAPI) for deep research.
  • Data Scraping (Schedule): A Schedule Trigger runs every 3 hours to fetch the latest posts from your specified Facebook page using the Apify Facebook Scraper.
  • Data Normalization & Storage: Extracted posts are normalized and upserted into an n8n Data Table. This prevents duplicate processing of the same posts in future runs.
  • Safety Analysis: Post text and downloaded images are merged and sent to a secondary AI Agent. The AI evaluates the context and user reactions to flag the content as "Safe" or "Toxic".
  • Smart Notification: The safety report is beautifully formatted using Telegram HTML and dispatched directly to the admin's Telegram inbox.

How to use

  1. Connect your Telegram Bot API credentials in both the Telegram Trigger and Send nodes.
  2. Connect your Google Gemini API key in all Language Model nodes.
  3. Connect your Apify API credentials and SerpAPI key.
  4. Configure your MongoDB connection for the chat memory nodes.
  5. Create an n8n Data Table (e.g., facebook_news_db) with a postId column (Number) and update the Data Table Upsert node to select your table.
  6. Customize the Set Context (Chat) and Set Context (Scraper) nodes with your specific details (Telegram Admin ID, Facebook Page URL, Bot Name).
  7. Activate the workflow and let the automation run.

Requirements

  • n8n Version: Built and tested on n8n 2.9.4+. (Note: You may encounter errors on older versions. It is highly recommended to update to the latest n8n version to use this workflow effectively).
  • Google Gemini API credentials.
  • Telegram Bot token.
  • Apify API credentials.
  • SerpAPI credentials.
  • MongoDB connection string.
  • An active n8n Data Table.

Customizing this workflow

  • Change the scraper: Swap the Apify node with any other social media scraping tool or RSS feed to monitor different platforms (e.g., X, LinkedIn).
  • Change the database: Replace the MongoDB Chat Memory node with Postgres or another memory node if you prefer a different database structure.
  • Modify the AI persona: Update the system prompt in the AI Agent nodes to change the chatbot's tone or the strictness of the safety evaluation.

About the Author

Created by: Nguyen Thieu Toan (Jay Nguyen)

Email: [email protected]

Website: nguyenthieutoan.com

Company: GenStaff (genstaff.net)

Socials (Facebook / X / LinkedIn): @nguyenthieutoan

More templates: n8n.io/creators/nguyenthieutoan

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.2

Block 2 - Set Context (Chat)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Chat AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 4 - Send Telegram Reply

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 5 - MongoDB Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryMongoDbChat - memoryMongoDbChat
Config choices
Version 1

Block 6 - SerpAPI Search

Type / Role
n8n-nodes-serpapi.serpApiTool - serpApiTool
Config choices
Version 1

Block 7 - Scrape Specific Page Tool

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2.2

Block 8 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.3

Block 9 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 10 - Set Context (Scraper)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Apify Facebook Scraper

Type / Role
@apify/n8n-nodes-apify.apify - apify
Config choices
Version 1

Block 12 - Normalize Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Data Table Upsert

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 14 - Format Post Content

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Has Image?

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.3

Block 16 - Download Image

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 17 - Aggregate Text

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 18 - Aggregate Images

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 19 - Merge Data

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 20 - Final Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 21 - Safety Analysis Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 22 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 23 - MongoDB Chat Memory 1

Type / Role
@n8n/n8n-nodes-langchain.memoryMongoDbChat - memoryMongoDbChat
Config choices
Version 1.1

Block 24 - Format Telegram Message

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Showing the first 24 of 35 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Monitor Facebook post safety with Apify, Google Gemini and Telegram alerts
Complexity advanced
Nodes 35
Categories Ticket Management, AI Chatbot
Author Nguyễn Thiệu Toàn (Jay Nguyen)
Published 13 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15698/15698.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Monitor Facebook post safety with Apify, Google Gemini and Telegram alerts do?

Monitor Facebook Pages and Analyze Content Safety via Telegram This n8n template automates the collection, storage, and safety analysis ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Chatbot use case.