[Grok 4 Usage Tips] A Prompt to Automatically Collect, Format, and Report Only the Needed Information from X (Twitter)
Using the generative AI tool Grok 4, I built a system that can automatically extract, organize, and report information from X (formerly Twitter) based on specific accounts or post content.
Why Automate Monitoring on X?
Every day, an enormous number of posts are made on X. Capturing industry news, customer opinions, or competitor activity in real time can be a major business advantage.
But manually checking posts is inefficient. That’s why I used Grok 4’s capabilities to automate the following:
💡 What You’ll Learn in This Article
- Example prompts to collect posts from X (Twitter) with Grok 4
- How to extract information based on specific accounts or keywords
- How to format posts into report-ready outputs
- How to set up recurring execution (task scheduling)
What is Grok 4?
Grok is an advanced generative AI developed by xAI (founded by Elon Musk), designed for deep understanding of natural language instructions. The latest version, Grok 4, excels at tasks like summarizing, formatting, and categorizing information.
Overview of the Prompt I Created
- Collects and organizes posts from multiple accounts (e.g., Yahoo News).
- Sorts posts based on multiple keywords mentioned in the content.
By sending this prompt to Grok, you can automatically collect → organize → report information daily.
🛠 Example Prompt (Multiple Accounts)
You are Grok, with access to public X (formerly Twitter) data. Follow the rules below and always output the latest results in Japanese at the time of execution.
########################
# STRICT CLOCK
########################
# - Current time must be taken from system time at execution. No guesses or fixed values.
# - Always use Asia/Tokyo timezone (JST). Olson ID: "Asia/Tokyo".
# - now_jst = now_utc converted to JST.
# - today_start_jst = now_jst date 00:00:00
# - today_end_jst = now_jst date 23:59:59
# - In headers and JSON, run_datetime_jst must be printed in ISO extended format (YYYY-MM-DDTHH:mm:ss).
########################
# Collection Scope & Ranking
########################
# - "Today’s posts": created_at (converted to JST) must be within [today_start_jst, today_end_jst].
# - "Top K posts in the last N days": based on window settings below.
TOP_INCLUDE_TODAY = true
# - window_start_jst = (TOP_WINDOW_DAYS-1) days ago at 00:00:00
# - window_end_jst = (TOP_INCLUDE_TODAY ? now_jst : yesterday 23:59:59)
# - Rank by views (desc). Ties = newer posts first. If views unknown, use fallback_score = likes*2 + reposts*3 + replies*1.
########################
# VERIFICATION REQUIRED
########################
# - After fetching candidates, verify each post before output. Do not output unverified posts.
# - Verification requirements (must meet at least one; both is better):
# (A) Fetch post_id and created_at via API/search, cross-check with body & URL.
# (B) Resolve official URL https://x.com/{handle}/status/{post_id} and ensure accessible (not private/deleted/locked).
# - If not verifiable (404/private/mismatch), exclude and record in notes.
# - Each output item must include post_id and verification_method ("api"|"url"|"both").
########################
# Default Policy
########################
DEFAULT_INCLUDE_QUOTES = true
DEFAULT_EXCLUDE_RETWEETS = true
DEFAULT_INCLUDE_REPLIES = false
TRANSLATE = {
"translate_non_target": false,
"target_lang": "ja",
"show_original_text": false
}
########################
# Bundles (Edit Here)
########################
BUNDLES = [
{
"name": "Yahoo News",
"user": { "handle": "@YahooNewsTopics" },
"top_window_days": 30,
"include_replies": true,
"translate": { "translate_non_target": false, "target_lang": "ja", "show_original_text": false }
},
{
"name": "Nikkei Business",
"user": { "handle": "@nikkei_business" },
"top_window_days": 14,
"include_replies": false,
"translate": { "translate_non_target": false, "target_lang": "ja", "show_original_text": true }
},
{
"name": "GIGAZINE",
"user": { "handle": "@gigazine" },
"top_window_days": 2,
"include_replies": false,
"translate": { "translate_non_target": false, "target_lang": "ja", "show_original_text": true }
}
]
########################
# Output Specs (Body)
########################
# 1) Header: execution time (now_jst, "YYYY-MM-DD HH:mm JST")
# 2) For each bundle, output in order:
# ◆{bundle.name} (target: {handle})
# — Today’s posts (JST)
# * New → Old. Each entry includes:
# - Datetime (JST, YYYY-MM-DD HH:mm)
# - Body (first 120 chars + "…", no line breaks)
# - Post URL (official URL format)
# - post_id
# - Metrics: views, likes, reposts, replies, bookmarks (as available)
# - Translation: if enabled and original language ≠ target_lang
# * Show total count + short note (≤100 chars)
# * If none: “No posts today”
# — Top 5 posts in last {top_window_days} days
# * Rank #1→#5, same format as above + fallback_used flag
# * Show total count + short note (≤100 chars)
# 3) End with overall notes (excluded counts/reasons).
(Truncated here for brevity; full JSON output rules remain the same as your Japanese text.)
🛠 Example Prompt (Keyword-Based)
The second example prompt defines THEMES with keyword filters (includes/excludes), then outputs only matching posts with strict validation, sorting, translation, and JSON formatting.
🧪 Use Cases
- Competitor Research: Automatically gather competitors’ SNS posts
- News Collection: Curate AI/tech-related topics
- Brand Monitoring: Track mentions of your company
- Trend Analysis: Spot keyword frequency and content patterns
🔁 Recurring Execution Ideas
With Grok’s task feature (as of 2025/8/18), you can schedule prompts to run automatically:
- Create a new task
- Configure frequency, time, and description
- Register under “Advanced User” options
✍️ Conclusion
Grok 4 isn’t just a chat AI—it’s also a powerful tool for information collection and formatting. It’s especially effective for monitoring and analyzing real-time SNS platforms like X (Twitter).
By leveraging Grok, you can save time and effort in information gathering, while efficiently retrieving only the data you need.