direct-messages
Direct Messages
Browser console scripts for sending, managing, and exporting X/Twitter DMs.
Available Scripts
| Script | File | Purpose |
|---|---|---|
| Send Direct Messages | src/sendDirectMessage.js |
Send personalized DMs to a list of users |
| DM Manager | src/dmManager.js |
Core DM management (read, filter, organize, export) |
Send Direct Messages
File: src/sendDirectMessage.js
Send personalized DMs to multiple users with message templates and rate limiting.
Configuration
const CONFIG = {
targetUsers: ['user1', 'user2'],
messageTemplate: 'Hey {username}! 👋 Just wanted to connect.',
limits: {
messagesPerSession: 10,
delayBetweenMessages: 30000,
},
skipIfAlreadyMessaged: true,
dryRun: true,
};
How to use
- Navigate to
x.com/messages - Edit CONFIG with target users and message template
- Set
dryRun: falsewhen ready - Open DevTools (F12) → Console
- Paste the script → Enter
Safety features
- Tracks sent messages in
localStorageto avoid duplicates - Configurable delay between messages (30s default)
- Session limit prevents over-messaging
- Dry-run mode previews actions without sending
Warning: Mass DMing can get your account restricted. Only message users who have open DMs or follow you.
DM Manager
File: src/dmManager.js
Core module for reading, filtering, organizing, and exporting DM conversations. Supports message requests, conversation search, and DM privacy settings.
How to use
- Navigate to
x.com/messages - Open DevTools (F12) → Console
- Paste the script → Enter
Key Selectors
| Element | Selector |
|---|---|
| New message button | [data-testid="NewDM_Button"] |
| Search people | [data-testid="searchPeople"] |
| Message input | [data-testid="dmComposerTextInput"] |
| Send button | [data-testid="dmComposerSendButton"] |
| Conversation list | [data-testid="conversation"] |
| Message bubble | [data-testid="messageEntry"] |
| Message requests | [data-testid="messageRequests"] |
| Back button | [data-testid="app-bar-back"] |
Notes
- DM scripts require being on the Messages page (
x.com/messages) - Group chats support up to 50 participants
- Message requests from non-followers must be approved before replying
- Add delays (30s+) between bulk DMs to avoid rate limits
{username}placeholder in templates is replaced with the recipient's handle- Sent history is persisted in
localStorageacross sessions
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.
25growth-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.
10content-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.
8content-posting
Create and publish content on X/Twitter programmatically. Post threads, schedule posts, create polls, auto-repost by keyword, compose threads with preview, quote-tweet with templates, repurpose content, and auto-plug replies on viral tweets. Use when automating content creation, scheduling, thread building, or content repurposing.
8content-cleanup
Mass-cleanup your X/Twitter account. Unlike all posts, clear all reposts/retweets, clear all bookmarks, and remove unwanted followers. Use when users want to clean their account history, remove old likes, or start fresh.
8analytics-insights
Analyze X/Twitter engagement, hashtags, competitors, best posting times, follower demographics, tweet performance, viral detection, content calendar gaps, A/B testing, and engagement leaderboards. Browser console scripts for data-driven X optimization. Use when users want insights about their X performance.
8