grok-ai
Grok AI Integration
Browser console scripts for automating interactions with X's built-in Grok AI assistant.
Script Selection
| Goal | File | Navigate to |
|---|---|---|
| Chat with Grok | src/grokIntegration.js |
x.com/i/grok |
| Generate images | src/grokIntegration.js |
x.com/i/grok |
| Analyze tweet with Grok | src/grokIntegration.js |
Any tweet |
Grok Integration
File: src/grokIntegration.js
Automates Grok AI prompts and response scraping.
How to Use
- Navigate to
x.com/i/grok - Open DevTools (F12) -> Console
- Paste the script -> Enter
Controls
XActions.ask(prompt)-- Send a prompt to GrokXActions.scrapeResponse()-- Capture Grok's latest responseXActions.generateImage(prompt)-- Request image generationXActions.batchAsk(prompts[])-- Send multiple prompts sequentiallyXActions.export()-- Download conversation history as JSON
Features
- Automated prompt submission with response capture
- Batch prompting for content generation workflows
- Image generation prompt automation
- Conversation history export
- Rate-limited to avoid triggering restrictions
DOM Selectors
| Element | Selector |
|---|---|
| Grok input | [data-testid="grokInput"] or textarea[placeholder] |
| Send button | [data-testid="grokSend"] |
| Response container | [data-testid="grokResponse"] |
| Image output | [data-testid="grokImage"] |
| Grok nav | a[href="/i/grok"] |
Content Strategy with Grok
Using Grok for content ideation
XActions.ask("What are the top 5 trending topics in {niche} right now?")XActions.ask("Write 3 tweet variations about {topic}")XActions.ask("Analyze this tweet for engagement: {tweet_text}")- Capture responses with
XActions.scrapeResponse() - Feed into
src/threadComposer.jsfor thread creation
Batch content generation
await XActions.batchAsk([
"Write a hot take about AI agents",
"Write a thread hook about productivity",
"Write a poll question about remote work",
"Suggest 5 tweet ideas about {niche}",
]);
XActions.export(); // Download all responses
Image generation workflow
XActions.generateImage("Professional headshot, tech founder, minimalist")- Wait for generation (10-30 seconds)
- Right-click generated image to save
- Use as profile picture, header, or tweet media
Requirements
- X Premium or Premium+ subscription
- Grok access varies by region and account tier
- Image generation requires Premium+ in most regions
- Rate limits: ~20 prompts/hour for chat, ~5 images/hour
MCP Alternative
For programmatic AI content without Grok, the XActions MCP server includes AI tools powered by OpenRouter:
| MCP Tool | Purpose |
|---|---|
x_analyze_voice |
Analyze account's writing style |
x_generate_tweet |
Generate tweet in user's voice |
x_rewrite_tweet |
Rewrite tweet for better engagement |
x_summarize_thread |
Summarize a thread |
These require an OPENROUTER_API_KEY env var but work without Premium.
Notes
- Grok responses are AI-generated and should be reviewed before posting
- Grok has real-time X data access -- can reference current trends
- Image generation creates original images (not screenshots/existing images)
- Conversation context is maintained within a chat session
More from nirholas/xactions
twitter-scraping
Scrapes X/Twitter data without API access using Puppeteer stealth and browser console scripts. Extracts profiles, followers, following lists, tweets, search results, hashtags, threads, media, bookmarks, notifications, DMs, likes, and viral tweets. Exports to JSON/CSV. Use when collecting, exporting, or analyzing Twitter data.
25direct-messages
Sends, manages, and automates direct messages on X/Twitter. Supports personalized bulk DMs with templates, conversation management, message request filtering, and DM export. The agent uses this skill when a user needs to send DMs, manage conversations, or automate direct messaging workflows.
10growth-automation
Automates X/Twitter growth via browser console scripts. Auto-likes tweets by keyword/user filters, auto-comments on target users, follows by keyword search or engagement, follows audiences of target accounts with rich filtering, trains the algorithm for niches, and runs combined growth suites. All require pasting core.js first. Use when automating Twitter growth, engagement, following, or audience building.
10engagement-interaction
Automates X/Twitter engagement actions — like, unlike, reply, bookmark, hide replies, and auto-like by keyword. Also bulk-unlikes all posts. Use when users want to automate likes, send replies, manage bookmarks on tweets, hide replies, or clear their entire likes history.
10follower-monitoring
Monitors X/Twitter follower changes using browser console scripts. Detects who unfollowed, tracks new followers with welcome messages, monitors any public account, runs continuous monitoring with alerts, tracks follower growth over time, and analyzes follower demographics. Use when tracking follower changes, detecting unfollowers, or monitoring Twitter accounts.
9content-repurposing
Identifies top-performing tweets and generates repurposed content variations including threads, tweet storms, blog outlines, summary tweets, and quote-tweet templates. Maximizes content ROI through systematic repurposing. Use when maximizing content output, planning a content calendar, or converting between content formats.
8