📖 XActions Complete Function Reference
Every function with real, working examples.
XActions.engage - Engagement Actions
like(tweetElement) - Like a tweet
// Like first tweet
const tweets = XActions.tweet.getAll()
await XActions.engage.like(tweets[0])
// Like first 10 tweets
for (const tweet of XActions.tweet.getAll().slice(0, 10)) {
await XActions.engage.like(tweet)
await new Promise(r => setTimeout(r, 500))
}
// Like tweets with keyword
async function likeByKeyword(keyword, max = 5) {
let count = 0
for (const tweet of XActions.tweet.getAll()) {
if (count >= max) break
const text = tweet.querySelector('[data-testid="tweetText"]')?.textContent || ""
if (text.toLowerCase().includes(keyword)) {
await XActions.engage.like(tweet)
count++
}
}
console.log(`Liked ${count} tweets with "${keyword}"`)
}
await likeByKeyword("web3", 5)
unlike(tweetElement) - Unlike a tweet
const tweets = XActions.tweet.getAll()
await XActions.engage.unlike(tweets[0])
retweet(tweetElement) - Retweet
// Retweet first tweet
const tweets = XActions.tweet.getAll()
await XActions.engage.retweet(tweets[0])
// Like + Retweet combo
async function boost(tweet) {
await XActions.engage.like(tweet)
await XActions.engage.retweet(tweet)
}
await boost(XActions.tweet.getAll()[0])
unretweet(tweetElement) - Undo retweet
const tweets = XActions.tweet.getAll()
await XActions.engage.unretweet(tweets[0])
bookmark(tweetElement) - Bookmark tweet
// Bookmark first tweet
await XActions.engage.bookmark(XActions.tweet.getAll()[0])
// Bookmark tweets with links
for (const tweet of XActions.tweet.getAll()) {
if (tweet.querySelector('a[href*="t.co"]')) {
await XActions.engage.bookmark(tweet)
}
}
unbookmark(tweetElement) - Remove bookmark
await XActions.engage.unbookmark(XActions.tweet.getAll()[0])
addToList(tweetElement, listName) - Add author to list
await XActions.engage.addToList(XActions.tweet.getAll()[0], "Interesting People")
report(tweetElement) - Report tweet
await XActions.engage.report(XActions.tweet.getAll()[0])
// Dialog opens - select reason manually
copyLink(tweetElement) - Copy tweet link
await XActions.engage.copyLink(XActions.tweet.getAll()[0])
console.log("Link copied to clipboard!")
shareViaDM(tweetElement, username) - Share via DM
await XActions.engage.shareViaDM(XActions.tweet.getAll()[0], "friendname")
embed(tweetElement) - Get embed code
await XActions.engage.embed(XActions.tweet.getAll()[0])
// Copy embed code from dialog
viewAnalytics(tweetElement) - View analytics
await XActions.engage.viewAnalytics(XActions.tweet.getAll()[0])
requestNote(tweetElement) - Request community note
await XActions.engage.requestNote(XActions.tweet.getAll()[0])
highlight(tweetElement) - Highlight (Premium)
await XActions.engage.highlight(XActions.tweet.getAll()[0])
XActions.user - User Interactions
follow(target) - Follow user
// By username
await XActions.user.follow("elonmusk")
// Follow list of users
const users = ["openai", "anthropic", "google"]
for (const u of users) {
await XActions.user.follow(u)
await new Promise(r => setTimeout(r, 2000))
}
unfollow(target) - Unfollow user
await XActions.user.unfollow("someuser")
block(username) - Block user
await XActions.user.block("spammer")
// Block multiple
for (const spam of ["spam1", "spam2"]) {
await XActions.user.block(spam)
}
unblock(username) - Unblock user
await XActions.user.unblock("formerlyblocked")
mute(username) - Mute user
await XActions.user.mute("annoying")
unmute(username) - Unmute user
await XActions.user.unmute("previouslymuted")
report(username) - Report user
await XActions.user.report("badactor")
addToList(username, listName) - Add to list
await XActions.user.addToList("techwriter", "Tech News")
// Build curated list
const leaders = ["paulg", "naval", "sama"]
for (const l of leaders) {
await XActions.user.addToList(l, "Founders")
}
notifyOn(username) - Turn on notifications
await XActions.user.notifyOn("mustwatchaccount")
notifyOff(username) - Turn off notifications
await XActions.user.notifyOff("toofrequent")
viewTopics(username) - View topics
await XActions.user.viewTopics("influencer")
viewLists(username) - View lists
await XActions.user.viewLists("curator")
viewFollowers(username) - View followers
await XActions.user.viewFollowers("competitor")
viewFollowing(username) - View following
await XActions.user.viewFollowing("tastemaker")
viewLikes(username) - View likes
await XActions.user.viewLikes("researcher")
viewMedia(username) - View media
await XActions.user.viewMedia("photographer")
viewReplies(username) - View replies
await XActions.user.viewReplies("activeuser")
viewHighlights(username) - View highlights
await XActions.user.viewHighlights("creator")
viewArticles(username) - View articles
await XActions.user.viewArticles("writer")
shareProfile(username) - Copy profile link
await XActions.user.shareProfile("coolaccount")
followsYou(username) - Check if follows you
const follows = await XActions.user.followsYou("someuser")
console.log(follows ? "They follow you!" : "They don't follow you")
// Find mutuals
async function findMutuals(users) {
const mutuals = []
for (const u of users) {
if (await XActions.user.followsYou(u)) mutuals.push(u)
}
return mutuals
}
getInfo(username) - Get user info
const info = await XActions.user.getInfo("openai")
console.log(`${info.displayName} - ${info.bio}`)
console.log(`Followers: ${info.followers}`)
restrict(username) - Restrict user
await XActions.user.restrict("limitedinteraction")
XActions.dm - Direct Messages
send(username, message) - Send DM
await XActions.dm.send("friend", "Hey! How are you?")
// Send to multiple
const team = ["member1", "member2"]
for (const m of team) {
await XActions.dm.send(m, "Team meeting at 3pm!")
}
open(username) - Open conversation
await XActions.dm.open("friend")
getConversations() - Get all conversations
const convos = await XActions.dm.getConversations()
console.log(`You have ${convos.length} conversations`)
deleteConversation(element) - Delete conversation
const convos = await XActions.dm.getConversations()
await XActions.dm.deleteConversation(convos[0].element)
leaveGroup() - Leave group DM
await XActions.dm.leaveGroup()
createGroup(usernames) - Create group DM
await XActions.dm.createGroup(["user1", "user2", "user3"])
sendImage() - Send image
await XActions.dm.sendImage()
// File picker opens - select manually
sendGif(searchTerm) - Send GIF
await XActions.dm.sendGif("celebration")
react(messageElement, emoji) - React to message
// React with heart
await XActions.dm.react(messageElement, "❤️")
XActions.search - Search & Discovery
query(query, filter) - Search
await XActions.search.query("javascript tips")
await XActions.search.query("AI news", "live") // Latest
top(query) - Top results
await XActions.search.top("startup advice")
latest(query) - Latest results
await XActions.search.latest("breaking news")
people(query) - Search people
await XActions.search.people("web developer")
photos(query) - Search photos
await XActions.search.photos("sunset photography")
videos(query) - Search videos
await XActions.search.videos("coding tutorial")
from(username) - Tweets from user
await XActions.search.from("elonmusk")
to(username) - Tweets to user
await XActions.search.to("openai")
mentions(username) - Mentions of user
await XActions.search.mentions("yourhandle")
hashtag(tag) - Search hashtag
await XActions.search.hashtag("buildinpublic")
advanced(options) - Advanced search
// Viral tweets from a user
await XActions.search.advanced({
from: "elonmusk",
minFaves: 10000,
since: "2024-01-01"
})
// Tech discussions with media
await XActions.search.advanced({
words: "AI startup",
hasMedia: true,
minRetweets: 100,
lang: "en"
})
// Find your mentions (excluding RTs)
await XActions.search.advanced({
mentioning: "yourusername",
excludeRetweets: true
})
// Job postings
await XActions.search.advanced({
words: "hiring",
hashtags: ["remotejobs"],
since: "2024-12-01"
})
getResults() - Get search results
await XActions.search.query("javascript")
const results = XActions.search.getResults()
console.log(`Found ${results.length} tweets`)
XActions.nav - Navigation
home() - Go to home
await XActions.nav.home()
explore() - Go to explore
await XActions.nav.explore()
notifications() - Go to notifications
await XActions.nav.notifications()
messages() - Go to messages
await XActions.nav.messages()
bookmarks() - Go to bookmarks
await XActions.nav.bookmarks()
lists() - Go to lists
await XActions.nav.lists()
communities() - Go to communities
await XActions.nav.communities()
premium() - Go to premium
await XActions.nav.premium()
profile(username) - Go to profile
await XActions.nav.profile("elonmusk")
await XActions.nav.profile() // Your own profile
settings() - Go to settings
await XActions.nav.settings()
notifyAll() - All notifications
await XActions.nav.notifyAll()
notifyVerified() - Verified notifications
await XActions.nav.notifyVerified()
notifyMentions() - Mentions only
await XActions.nav.notifyMentions()
forYou() - For You timeline
await XActions.nav.forYou()
following() - Following timeline
await XActions.nav.following()
trending() - Trending
await XActions.nav.trending()
news() - News tab
await XActions.nav.news()
sports() - Sports tab
await XActions.nav.sports()
entertainment() - Entertainment tab
await XActions.nav.entertainment()
spaces() - Spaces page
await XActions.nav.spaces()
scrollToTop() - Scroll to top
XActions.nav.scrollToTop()
scrollToBottom() - Scroll to bottom
XActions.nav.scrollToBottom()
scrollBy(pixels) - Scroll by amount
XActions.nav.scrollBy(500) // Scroll down 500px
XActions.nav.scrollBy(-200) // Scroll up 200px
back() - Browser back
XActions.nav.back()
forward() - Browser forward
XActions.nav.forward()
refresh() - Refresh page
XActions.nav.refresh()
XActions.lists - List Management
create(name, description, isPrivate) - Create list
// Public list
await XActions.lists.create("Tech News", "Best tech journalists", false)
// Private list
await XActions.lists.create("Competitors", "Track competitor accounts", true)
delete(listId) - Delete list
await XActions.lists.delete("1234567890")
edit(listId, newName, newDescription) - Edit list
await XActions.lists.edit("1234567890", "Updated Name", "New description")
follow(listId) - Follow list
await XActions.lists.follow("1234567890")
unfollow(listId) - Unfollow list
await XActions.lists.unfollow("1234567890")
pin(listId) - Pin/unpin list
await XActions.lists.pin("1234567890")
getAll() - Get all lists
const lists = await XActions.lists.getAll()
console.log(`You have ${lists.length} lists`)
viewMembers(listId) - View list members
await XActions.lists.viewMembers("1234567890")
viewFollowers(listId) - View list followers
await XActions.lists.viewFollowers("1234567890")
XActions.settings - Account Settings
account() - Account settings
await XActions.settings.account()
security() - Security settings
await XActions.settings.security()
privacy() - Privacy settings
await XActions.settings.privacy()
notifications() - Notification settings
await XActions.settings.notifications()
accessibility() - Accessibility settings
await XActions.settings.accessibility()
monetization() - Monetization settings
await XActions.settings.monetization()
creatorSubs() - Creator subscriptions
await XActions.settings.creatorSubs()
premium() - Premium settings
await XActions.settings.premium()
mutedAccounts() - View muted accounts
await XActions.settings.mutedAccounts()
mutedWords() - View muted words
await XActions.settings.mutedWords()
blockedAccounts() - View blocked accounts
await XActions.settings.blockedAccounts()
addMutedWord(word) - Add muted word
await XActions.settings.addMutedWord("spoilers")
await XActions.settings.addMutedWord("politics")
downloadData() - Download your data
await XActions.settings.downloadData()
deactivate() - Deactivate page
await XActions.settings.deactivate()
// Proceed with caution!
XActions.profile - Profile Editing
edit() - Open profile editor
await XActions.profile.edit()
updateName(newName) - Update display name
await XActions.profile.updateName("John Doe 🚀")
updateBio(newBio) - Update bio
await XActions.profile.updateBio("Building cool stuff | Founder @startup | DMs open")
updateLocation(location) - Update location
await XActions.profile.updateLocation("San Francisco, CA")
updateWebsite(url) - Update website
await XActions.profile.updateWebsite("https://mywebsite.com")
updateAvatar() - Change avatar
await XActions.profile.updateAvatar()
// File picker opens
updateHeader() - Change header
await XActions.profile.updateHeader()
// File picker opens
switchToProfessional() - Professional account
await XActions.profile.switchToProfessional()
XActions.utils - Utilities
getCurrentUser() - Get current username
const me = XActions.utils.getCurrentUser()
console.log(`Logged in as @${me}`)
isLoggedIn() - Check if logged in
if (XActions.utils.isLoggedIn()) {
console.log("Ready to automate!")
} else {
console.log("Please log in first")
}
getTokens() - Get auth tokens
const tokens = XActions.utils.getTokens()
console.log("CSRF token:", tokens.ct0)
// Useful for API calls
getTweetIdFromUrl(url) - Extract tweet ID
const id = XActions.utils.getTweetIdFromUrl("https://x.com/user/status/123456789")
console.log(id) // "123456789"
getUsernameFromUrl(url) - Extract username
const user = XActions.utils.getUsernameFromUrl("https://x.com/elonmusk")
console.log(user) // "elonmusk"
waitForPageLoad() - Wait for page
await XActions.utils.waitForPageLoad()
console.log("Page ready!")
loadMore(times) - Scroll to load more
await XActions.utils.loadMore(5) // Scroll 5 times
clearXData() - Clear localStorage
XActions.utils.clearXData()
exportBookmarks(maxItems) - Export bookmarks
// Export 100 bookmarks
const bookmarks = await XActions.utils.exportBookmarks(100)
console.log(bookmarks)
// Download as JSON
const bookmarks = await XActions.utils.exportBookmarks(500)
const blob = new Blob([JSON.stringify(bookmarks, null, 2)], {type: 'application/json'})
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = 'bookmarks.json'
a.click()
exportLikes(username, maxItems) - Export likes
const likes = await XActions.utils.exportLikes("myusername", 200)
console.log(`Exported ${likes.length} liked tweets`)
copyToClipboard(text) - Copy to clipboard
await XActions.utils.copyToClipboard("Hello world!")
screenshotTweet(tweetUrl) - Screenshot tweet
await XActions.utils.screenshotTweet("https://x.com/user/status/123")
// Opens screenshot service in new tab
showKeyboardShortcuts() - Show shortcuts
XActions.utils.showKeyboardShortcuts()
devMode() - Enable dev mode
XActions.utils.devMode()
// All elements outlined with data-testid labels
getAllSelectors() - Get all selectors
const selectors = XActions.utils.getAllSelectors()
console.log(selectors) // Array of all data-testid values on page
XActions.spaces - Twitter Spaces
browse() - Browse spaces
await XActions.spaces.browse()
join(spaceId) - Join space
await XActions.spaces.join("1234567890")
leave() - Leave space
await XActions.spaces.leave()
requestToSpeak() - Request to speak
await XActions.spaces.requestToSpeak()
setReminder(spaceId) - Set reminder
await XActions.spaces.setReminder("1234567890")
share() - Share space
await XActions.spaces.share()
XActions.communities - Communities
browse() - Browse communities
await XActions.communities.browse()
view(communityId) - View community
await XActions.communities.view("1234567890")
join(communityId) - Join community
await XActions.communities.join("1234567890")
leave(communityId) - Leave community
await XActions.communities.leave("1234567890")
post(communityId, text) - Post in community
await XActions.communities.post("1234567890", "Hello community! 👋")
🔥 Power User Recipes
Like & Follow from Search Results
await XActions.search.query("web3 developer")
await new Promise(r => setTimeout(r, 2000))
const tweets = XActions.tweet.getAll().slice(0, 10)
for (const tweet of tweets) {
await XActions.engage.like(tweet)
await XActions.user.follow(tweet)
await new Promise(r => setTimeout(r, 3000))
}
Export All Your Bookmarks to JSON
const bookmarks = await XActions.utils.exportBookmarks(1000)
const blob = new Blob([JSON.stringify(bookmarks, null, 2)], {type: 'application/json'})
const a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = `bookmarks-${Date.now()}.json`
a.click()
console.log(`Exported ${bookmarks.length} bookmarks!`)
Find Non-Mutuals
const following = ["user1", "user2", "user3", "user4", "user5"]
const nonMutuals = []
for (const user of following) {
if (!(await XActions.user.followsYou(user))) {
nonMutuals.push(user)
}
await new Promise(r => setTimeout(r, 2000))
}
console.log("Non-mutuals:", nonMutuals)
Auto-Engage with Hashtag
await XActions.search.hashtag("buildinpublic")
await new Promise(r => setTimeout(r, 2000))
for (const tweet of XActions.tweet.getAll().slice(0, 5)) {
await XActions.engage.like(tweet)
await XActions.engage.bookmark(tweet)
await new Promise(r => setTimeout(r, 2000))
}
Daily Posting Schedule
const posts = [
"Good morning! ☀️ What are you building today?",
"Tip of the day: Always test your code before deploying 🧪",
"Evening thought: Consistency beats intensity 💪"
]
for (const post of posts) {
await XActions.tweet.post(post)
// In real usage, you'd schedule these with setTimeout or cron
}
← Back to Automation Guide | ⭐ Star on GitHub
⚡ Explore XActions
100% free and open-source. No API keys, no fees, no signup.
Browse All Documentation