How to Log Trending Topics to a Notion Database
Log trending topics to a Notion database automatically: verified schema, runnable Notebook-ready API and SDK code, dedupe, scheduling, and troubleshooting.

To automate trending topics into a Notion database, you need three things: a structured Notion database with the right property types, a source that ranks topics by momentum, and a scheduled job that writes ranked rows into the database without creating duplicates. The most reliable pattern is a small script or agent that pulls ranked topics from a trend intelligence API, maps each topic to Notion properties, and creates one page per topic on a schedule.
This guide gives you a verified schema, runnable code against the TrendsAGI REST API and Python SDK, deduplication and scheduling patterns, and an honest comparison of no-code templates versus a purpose-built trend API. Notion users already create databases with slash commands and map each column to a property, as Notion's own help documentation describes, so the schema step takes minutes; the durable engineering work is in the pipeline.
Why people automate trending topics into Notion
Notion databases are widely used as the storage layer for automated trend and content-idea pipelines, as shown by existing n8n and Zapier templates that push Reddit hot posts and news sentiment reports into Notion databases. A Zapier integration, for example, can add new hot Reddit posts to a Notion database as items automatically, and an n8n workflow template automates trend research to blog drafts and saves the output directly to Notion.
Notion's developer platform supports the pattern: developers.notion.com documents API reference sections, guides, webhook events, agents, and an MCP-related option, and exposes OpenAPI schemas including an admin API spec. The platform breadth means the Notion side of the pipeline is well-trodden; the differentiator is the quality and velocity measurement of the topics you ingest.
Step 1: Design the Notion database schema
Create a database inside a page (slash command or the ••• → Table option, per Notion's documentation), then rename each column to match the properties below. Property names matter because your automation writes to them by exact name.
| Property name | Notion type | Populated by |
|---|---|---|
| Topic | Title | Trend name |
| Trend ID | Number | TrendsAGI trend id (dedupe key) |
| Category | Select | Trend category |
| Velocity | Number | Posts per hour, measured from snapshots |
| Growth | Number | Growth measure |
| Volume | Number | Observed post volume |
| Summary | Rich text | AI insight summary |
| Key themes | Multi-select | AI insight key themes |
| Sentiment | Select | AI insight sentiment |
| Audience | Rich text | AI insight audience |
| Captured at | Date | Run timestamp |
| Status | Select | New, Reviewing, Drafted, Archived |
Two properties do the heavy lifting: Trend ID for deduplication and Status so a human can triage the log. Velocity is a measured snapshot rate (posts per hour from stored snapshots), not a forecast or unique-user count, so label it accordingly rather than treating it as an audience size.
Step 2: Pull ranked trending topics from TrendsAGI
TrendsAGI (https://trendsagi.com) detects topics gaining attention on social platforms, measures velocity and growth from stored snapshots, and explains them with AI insights covering summary, key themes, sentiment, audience and marketing angles. The REST API base URL is https://api.trendsagi.com; authenticate with the header X-API-Key or Authorization: Bearer.
curl -s "https://api.trendsagi.com/api/trends?category=Technology&sort_by=velocity&sort_dir=desc&limit=20" \
-H "X-API-Key: $TRENDSAGI_API_KEY"Then pull insights for a specific trend:
curl -s "https://api.trendsagi.com/api/trends/123/ai-insights" \
-H "X-API-Key: $TRENDSAGI_API_KEY"Useful endpoints for this workflow: GET /api/trends, GET /api/trends/categories, GET /api/trends/{id}, GET /api/trends/{id}/ai-insights, GET /api/trends/{id}/analytics?period=24h|7d|30d, and GET /api/insights/search?q=... for keyword-driven discovery.
The Python SDK removes the HTTP boilerplate:
import os
from trendsagi import TrendsAGIClient
client = TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"])
trends = client.get_trends(category="Technology", sort_by="velocity", limit=20)
for trend in trends:
insights = client.get_ai_insights(trend["id"])
print(trend["name"], trend.get("volume"))
print(insights)Step 3: Write rows into Notion via the API
Notion's developer documentation at developers.notion.com lists API reference guides and OpenAPI schemas you can consult for the exact request shape, and your integration needs a valid token plus explicit sharing of the target database with that integration before writes succeed. Share the database from the database menu (per Notion's standard sharing flow), store the token in an environment variable, and never inline it in code.
The write pattern is: build a properties payload that matches the exact property names from Step 1, then create one page per trend. The snippet below keeps all Notion calls behind a single function so the dedupe and scheduling logic stays readable.
import os
import requests
from datetime import datetime, timezone
from trendsagi import TrendsAGIClient
NOTION_TOKEN = os.environ["NOTION_TOKEN"]
NOTION_DATABASE_ID = os.environ["NOTION_DATABASE_ID"]
NOTION_VERSION = "2022-06-28"
HEADERS = {
"Authorization": f"Bearer {NOTION_TOKEN}",
"Notion-Version": NOTION_VERSION,
"Content-Type": "application/json",
}
def existing_trend_ids():
ids = set()
cursor = None
while True:
body = {"page_size": 100}
if cursor:
body["start_cursor"] = cursor
r = requests.post(
f"https://api.notion.com/v1/databases/{NOTION_DATABASE_ID}/query",
headers=HEADERS, json=body, timeout=30,
)
r.raise_for_status()
data = r.json()
for page in data.get("results", []):
prop = page["properties"].get("Trend ID", {})
if prop.get("number") is not None:
ids.add(int(prop["number"]))
if not data.get("has_more"):
return ids
cursor = data.get("next_cursor")
def to_properties(trend, insights):
themes = insights.get("key_themes") or []
return {
"Topic": {"title": [{"text": {"content": trend["name"][:200]}}]},
"Trend ID": {"number": trend["id"]},
"Category": {"select": {"name": trend.get("category", "Unknown")}},
"Velocity": {"number": trend.get("velocity")},
"Growth": {"number": trend.get("growth")},
"Volume": {"number": trend.get("volume")},
"Summary": {"rich_text": [{"text": {"content": (insights.get("summary") or "")[:2000]}}]},
"Key themes": {"multi_select": [{"name": str(t)[:100]} for t in themes[:10]]},
"Sentiment": {"select": {"name": str(insights.get("sentiment", "Unknown"))[:100]}},
"Audience": {"rich_text": [{"text": {"content": (str(insights.get("audience", "")))[:2000]}}]},
"Captured at": {"date": {"start": datetime.now(timezone.utc).isoformat()}},
"Status": {"select": {"name": "New"}},
}
def create_row(properties):
r = requests.post(
"https://api.notion.com/v1/pages",
headers=HEADERS,
json={"parent": {"database_id": NOTION_DATABASE_ID}, "properties": properties},
timeout=30,
)
r.raise_for_status()
return r.json()["id"]
client = TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"])
known = existing_trend_ids()
written = 0
for trend in client.get_trends(category="Technology", sort_by="velocity", limit=20):
if int(trend["id"]) in known:
continue
insights = client.get_ai_insights(trend["id"])
create_row(to_properties(trend, insights))
known.add(int(trend["id"]))
written += 1
print(f"Created {written} new trend rows")Step 4: Deduplicate and schedule the refresh
Duplicates are the most common defect in trend-to-Notion pipelines. Two patterns work: query-before-insert using a stable key (Trend ID above) and an idempotency check against the same key on every run. If your database grows large, query only pages created since the last run by filtering on the Captured at date property instead of paginating the whole database.
For scheduling, run the script every hour or daily from a job runner. If you prefer event-driven runs, TrendsAGI webhooks can push trend events to an endpoint: POST /api/integrations/webhooks with url, trigger_type (trend_velocity or trend_category), delivery_mode (threshold or instant_stream), threshold_value, keywords and cooldown_seconds. Note the operational detail: new subscriptions start paused, so send POST /api/integrations/webhooks/{id}/test and then PATCH /api/integrations/webhooks/{id} with {"is_active": true}. Each delivery is a JSON POST with an X-Webhook-Signature header containing the lowercase hex HMAC-SHA256 of the exact raw request body, keyed with the signing secret returned once at creation; verify it against unmodified raw bytes with a constant-time comparison. The delivery body's field list is not documented in the fact sheet for this integration, so send a test delivery first and map fields from what actually arrives rather than assuming names.
Teams that want a lighter-weight alert can pair the log with Slack notifications and Google Sheets exports, and the released ad-platform connectors (Google Ads, Meta Ads and Conversions API, TikTok Ads, LinkedIn Ads, Microsoft Ads, Pinterest Ads, Snapchat Ads, Reddit Ads) can act on promoted topics after a preview step.
Step 5: Optional agent and MCP access
For agent builders, the SDK exposes read-only tools by default: TrendsAGITools(client), with allow_writes=True adding write tools. tools.openai(), tools.openai_responses(), tools.anthropic() and tools.langchain() adapt the toolset to each framework, and tools.call(name, arguments) returns a dict with result data or an error. The hosted MCP server at https://api.trendsagi.com/mcp supports Streamable HTTP with OAuth or an API-key bearer token, read-only tools, and a one-command Claude Code registration: claude mcp add --transport http trendsagi https://api.trendsagi.com/mcp. Notion's own MCP option is documented separately at developers.notion.com; treat it as the Notion-side read path and keep trend ingestion on the TrendsAGI side so access scopes stay narrow.
No-code templates versus a custom trend API
| Approach | Strengths | Trade-offs |
|---|---|---|
| Zapier / Make templates | Fast first row; familiar UI; good for single-source monitoring such as Reddit hot posts | Task-based plans and per-step limits; logic sprawl as sources multiply; dedupe usually manual |
| n8n workflow | Self-hostable; template automation of trend research to blog drafts saved to Notion | You own scraping, retries and API maintenance; velocity measurement is your problem |
| Custom TrendsAGI pipeline | Measured velocity, growth, AI insights, recommendations and watchlist alerts in one call; agent and MCP ready | Requires code ownership; recommendation confidence measures evidence completeness, not probability of success |
Choose templates when you need one source and one destination with no ranking logic. Choose the API when you need comparable velocity across sources, explainable insight fields, and a schema you control.
Practical use cases
- Creator daily dashboard: schedule the Step 3 script each morning with Status = New, so a writer opens Notion to 20 fresh topic ideas with summaries and themes already attached.
- Marketing theme archive: keep every run and let Status shift from Reviewing to Drafted, giving a searchable record of which themes recurred and when, with the velocity recorded at capture time.
- Automated trend pipeline: combine the SDK script with webhook triggers so high-velocity spikes create rows immediately, while hourly runs fill in steady-state coverage.
- Agent-assisted research: expose TrendsAGI tools to an assistant and let it query recommendations and crisis events, then file summaries into a Notion database as the archive of record.
Troubleshooting
- Writes fail with a permission error: the database has not been shared with your Notion integration. Share the database explicitly, then retry.
- Property validation errors: property names in the payload must match the Notion schema exactly, including capitalization. A mismatch raises an error rather than silently skipping the value.
- Duplicate rows: confirm Trend ID is a Number property and that the dedupe query runs before inserts; do not compare topic names, which can change.
- Webhook never fires: new subscriptions start paused. Send the test delivery and then PATCH is_active to true.
- Signature checks fail: compute HMAC-SHA256 over the unmodified raw request body, not a re-serialized JSON object, and compare in constant time.
- Empty AI insight fields: not every trend has every insight populated; guard optional fields rather than letting a missing value abort the run.
- Rate limits and pagination caps: Notion's documented pages reviewed for this article do not state rate limits or pagination limits, so implement retries and cursor-based loops defensively instead of assuming thresholds.
Frequently asked questions
What database properties and schema do I need for a trending topics log in Notion?
Use a Title property for the topic name, a Number property for the source trend ID, Select properties for category, sentiment and status, Number properties for velocity, growth and volume, Rich text for summary and audience, Multi-select for key themes, and a Date property for capture time.
Which tools can pull trending topics and write rows into Notion (n8n, Zapier, Make, custom API)?
Zapier has integrations that add new hot Reddit posts to a Notion database, n8n templates automate trend research to blog drafts saved to Notion, and Make connects through webhooks and HTTP calls. A custom script using the TrendsAGI REST API or Python SDK gives you ranked topics with measured velocity and AI insights in the same request path.
How do I create pages in a Notion database via the API, and which auth and sharing steps are required?
Create a Notion integration, store its token in an environment variable, share the target database with the integration, then POST to the pages endpoint with the parent database id and a properties object matching your schema. developers.notion.com documents the API reference and OpenAPI schemas for exact request shapes.
How do I avoid duplicate entries and keep the log fresh on a schedule?
Store a stable source identifier (such as Trend ID) as a Number property, query the database for existing IDs before each insert, and run the job on a fixed schedule. For high-velocity spikes, add a signed webhook trigger so new topics land between scheduled runs.
Can agents or an MCP server query my Notion database, and what are the access limits?
Notion documents an MCP option and agent tooling on developers.notion.com, so agent access is possible on the Notion side. Whether those features have plan restrictions or are generally available is not stated in the pages reviewed, so confirm in Notion's current documentation before designing around it.
What are the trade-offs between no-code templates and a custom trend-intelligence API?
Templates are fast to start but leave scraping, retries, deduplication and velocity calculation to you, and task-based plans can become costly as steps multiply. A custom API gives you measured velocity, growth and AI insight fields plus agent and MCP access, at the cost of owning a small amount of code.
How we researched this
Prepared by TrendsAGI Research. Facts checked on 1 November 2026 against the sources listed below.
We read the official Notion documentation listed below. The TrendsAGI steps and code use its documented REST API and Python SDK; confirm the Notion side against its current documentation, since third-party products change.
| Claim | Applies to | Source |
|---|---|---|
| Notion publishes a developer documentation site with API reference, guides, webhook events, agents, and MCP-related contextual options. | Public developer docs | developers.notion.com |
| Notion's docs config lists API reference sections including 139 API Reference, 121 Endpoints, 61 Guides, 31 Webhook events, and 22 Agents entries. | Public developer docs | developers.notion.com |
| Notion exposes OpenAPI schemas including an admin API spec for developers. | Public developer docs | developers.notion.com |
| A Zapier integration can add new hot Reddit posts to a Notion database as items automatically. | All plans | zapier.com |
| Notion users can create a database via the slash command or the ••• → Table option, with each column mapped to a property. | All plans | notion.com |
| An n8n workflow template automates trend research to blog drafts, saving output directly to Notion. | All plans | n8nflow.net |
We re-research and rewrite this page at least every four months; the updated date only changes when the facts are re-checked.
Sources
- Notion connections - Notion Docs — developers.notion.com
- Create a database in Notion — notion.com
- Add new hot Reddit posts to a Notion database as items (Zapier) — zapier.com
- Automate Trend Research to Blog Content with GPT-4o, DALL-E & Apify to Notion (n8nflow.net) — n8nflow.net