# apify-twitter > Read/write public Twitter/X posts via Apify. Do not call a tool named apify-twitter; use exec to run: node tools/apify-twitter/cli.js read|write ... - Author: Corey Szopinski - Repository: coreindustries/core-openclaw-docker - Version: 20260201075255 - Stars: 2 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/coreindustries/core-openclaw-docker - Web: https://mule.run/skillshub/@@coreindustries/core-openclaw-docker~apify-twitter:20260201075255 --- --- name: apify-twitter description: "Read/write public Twitter/X posts via Apify. Do not call a tool named apify-twitter; use exec to run: node tools/apify-twitter/cli.js read|write ..." metadata: {"openclaw":{"requires":{"env":["APIFY_TOKEN"]},"primaryEnv":"APIFY_TOKEN"}} --- ## Triggers This skill activates when a user message matches any of the following: - `/twitter search ` or "search Twitter for ..." / "find tweets about ..." - "read @handle tweets" / "get tweets from @handle" / "latest tweets from @handle" - "What did [@handle] post?" / "Show me [@handle]'s latest tweets" / "Twitter timeline for ..." - "Post to Twitter ..." / "Tweet ..." / "Send a tweet ..." - "Reply to tweet [id] with ..." - Any natural language request to read or write Twitter/X posts ## Behavior ### Read (search or profile) 0. **Important**: This skill reads **public posts** (tweets) via Apify. It cannot read private X/Twitter DMs. 1. **Search**: Use the Apify Twitter tool via the OpenClaw `exec` tool (do **not** use `web_search` for tweets). - Query can be: keyword, `from:username`, `#hashtag`, or Twitter advanced search syntax. - Default `maxItems`: 25 (cap at 500). - Sort: "Latest" (default) or "Top". 2. **Profile / timeline**: Use the tool to fetch a user's timeline. - Handles can be usernames (e.g. `NASA`) or full URLs (e.g. `https://x.com/NASA`). 3. **How to invoke (required)**: Always run the CLI via `exec` and parse JSON output. - Search: - `node {baseDir}/cli.js read --search "from:apify" --max 20 --sort latest` - Timeline: - `node {baseDir}/cli.js read --handles NASA --max 20` - The CLI prints JSON: `{ items: [...], runId: "..." }`. 4. **Response**: Summarize the returned `items` (tweet text, author, date, likes/retweets, URL). If no results, say so clearly. ### Write (post tweet) 1. **Post**: Use the Apify Twitter tool via the OpenClaw `exec` tool (CLI). - Optional: `replyToTweetId` to reply to a specific tweet. 2. **How to invoke**: Run the Node tool: - `node {baseDir}/cli.js write --text "Hello from OpenClaw"` - If you must call the module directly (ESM), use `import` (not `require`): - `node -e "import { writePost } from './tools/apify-twitter/index.js'; writePost({ text: 'Hello from OpenClaw' }).then(r=>console.log(JSON.stringify(r,null,2)))"` 3. **Response**: Confirm success or report failure. Do not post without explicit user request. 4. **Credentials**: Posting requires the Twitter Poster actor to be configured (Twitter API keys or browser cookies in Apify). If the user has not set this up, inform them how to configure the actor and `APIFY_TOKEN`. ## Data Source - **Read**: Apify actor `apidojo/tweet-scraper` (search and profile). - **Write**: Apify actor `pixelated_pulse/twitter-poster` (post/reply). Both require **APIFY_TOKEN** (get one at https://console.apify.com/account/integrations). Posting may require additional Twitter credentials in the actor input or Apify environment. ## Error Handling - **Missing APIFY_TOKEN**: "Twitter integration is not configured. An Apify API token is required (APIFY_TOKEN)." - **No results**: "No tweets found for that search/profile." - **Post failed**: "The tweet could not be posted. Check that the Twitter Poster actor is configured in Apify and that credentials are valid." - **Rate/limit errors**: Suggest trying again later or reducing `maxItems`. ## Dependencies - Node.js 18+ - Package: `tools/apify-twitter` (run `npm install` in `tools/apify-twitter`). In Docker, ensure the tool is available in the workspace or mount the repo `tools` directory. - Network access to Apify API (`api.apify.com`).