Skip to content
Twexapi
English
Esc
↑↓navigate↵open⌘Jpreview
On this page

n8n

Build n8n Twitter workflows for tweet search, user lookup, trending tweets, AI agents, and cursor-safe handoffs through TwexAPI.

Build an n8n Twitter workflow with TwexAPI. Search tweets, look up users, read trending tweets, and run AI agents. This integration uses the TwexAPI community node, HTTP Request, Webhook, and MCP Client Tool nodes.

twexapi-dev/n8n-nodes-x-api-scrapern8n nodes for TwexAPI public social data workflows: search, profiles, trends, and balance. Independent third-party service.00

TwexAPI uses one API key and the REST base URL https://api.twexapi.io.

Choose an n8n Twitter integration

TwexAPI community node

Install @twexapi-dev/n8n-nodes-x-api-scraper for tweet search, user search, profile lookup, trending tweets, and balance checks.

HTTP Request + MCP

Use HTTP Request for any documented REST route. Use MCP Client Tool when an AI agent should discover endpoints first.

Prerequisites

  • TwexAPI API key
  • n8n Cloud or self-hosted n8n
  • Optional Slack and Google Sheets credentials for the recipes below

Install the community node

Install @twexapi-dev/n8n-nodes-x-api-scraper from Settings → Community Nodes.

npm install @twexapi-dev/n8n-nodes-x-api-scraper

Source: twexapi-dev/n8n-nodes-x-api-scraper

Supported operations

Task n8n operation TwexAPI route
Search tweets Tweet: search POST /twitter/advanced_search/page
Search users User: search GET /twitter/search-user/{keyword}/{target_count}
Lookup a profile User: get GET /twitter/{screen_name}/about
Read trending tweets Trend: get GET /twitter/global-trending/tweets
View balance Account: get balance GET /balance

Use the REST API for follower pagination, lists, communities, and approved posting. TwexAPI does not expose native account monitors or event webhooks—use scheduled REST calls or no-code platform webhooks for recurring jobs.

API key credential

Create a reusable n8n credential for TwexAPI:

Authentication

Select Header Auth for the TwexAPI API credential or HTTP Request credential.

Header name

Set the header name to Authorization.

Header value

Paste Bearer YOUR_API_KEY as the credential value.

Use that credential in every HTTP Request node that calls https://api.twexapi.io.

For MCP-capable AI Agent nodes, configure the MCP Client Tool with https://api.twexapi.io/mcp and header x-api-key: YOUR_API_KEY.

Result handoff

Use an Edit Fields node after each HTTP Request or TwexAPI node when the next node only needs stable handoff fields. Keep raw responses out of Slack messages, Sheets rows, and retry queues.

Tweet search page

Store request query; map each tweet id, text, author username, and created_at to tweet_id, text, author_username, and created_at; keep has_next_page and next_cursor for page loops.

User profile rows

Store source id as user_id, plus username, name, follower counts, and the lookup or search input.

Trend rows

Store each trend name, topic, content tag, and country. Keep the requested region with the workflow run.

Tweet or reply write

Write actions need a saved cookie or auth_token. Preview with the CLI --dry-run before posting from n8n.

Recipe 1: AI agent X research with MCP

Use this recipe to integrate AI agents with TwexAPI. The agent can search live tweets, summarize trends, inspect profiles, and compare follower activity.

Add an AI Agent node

Create an AI Agent workflow with your preferred chat model.

Add an MCP client tool

Set Server Transport to HTTP Streamable. Set MCP Endpoint URL to https://api.twexapi.io/mcp. Set Authentication to Header Auth with name x-api-key and your TwexAPI API key.

Prompt the agent

Tell the agent to call explore first, then twexapi_request, and return only JSON.

Suggested agent system prompt:

Use TwexAPI for every X research request. Call explore before twexapi_request. Search tweets, inspect accounts, and cite the returned post URLs. Prefer small, targeted searches before broad exports.

Example user prompt:

Find recent posts about AI agents in fintech, group them by theme, and list 5 accounts worth monitoring.
Return only JSON with route_used, tweets, has_more, and next_cursor.

The MCP server exposes explore for endpoint discovery and twexapi_request for authenticated calls.

Recipe 2: Tweet search to Slack

Use the TwexAPI community node or HTTP Request to search tweets, then alert a Slack channel.

Workflow shape

Schedule or manual trigger

Run on a schedule or manually while testing.

Search tweets

Use the TwexAPI node or HTTP Request to call POST /twitter/advanced_search/page.

Split rows

Split Out over returned tweets.

Post alert

Send formatted text to Slack.

HTTP Request example

{
  "method": "POST",
  "url": "https://api.twexapi.io/twitter/advanced_search/page",
  "headers": {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  "body": {
    "searchTerms": ["AI agents lang:en"],
    "sortBy": "Latest",
    "nextCursor": ""
  }
}

Slack message

Use a Set node before Slack:

@{{$json.author_username || $json.user?.screen_name}}
{{$json.text || $json.full_text}}
https://x.com/i/web/status/{{$json.tweet_id || $json.id}}

Recipe 3: Search results to Google Sheets

Use this when a team needs tweet search results in a spreadsheet.

Workflow shape

Schedule trigger

Run daily or hourly exports; execute manually while testing.

Search tweets

Use the TwexAPI node or HTTP Request to search tweets and store next_cursor.

Split rows

Split Out over returned tweets.

Append rows

Use Google Sheets Append Row with the mapped result fields below.

Map these fields into Google Sheets:

Tweet ID

Map to id or tweet_id.

Author

Map to author username or screen name.

Text

Map to text or full_text.

Created at

Map to created_at or createdAt.

URL

Build from https://x.com/i/web/status/{id}.

For larger jobs, loop while has_next_page or has_more is true and pass next_cursor back into the search body.

Useful REST actions

Search tweets

Run X query searches with POST /twitter/advanced_search/page.

Get user profile

Fetch an X profile with GET /twitter/{screen_name}/about.

Get followers

Read follower lists with POST /v3/twitter/users/followers.

Get trends

Read global trending tweets with GET /twitter/global-trending/tweets.

Create tweet

Publish text or media posts with POST /twitter/tweets/create.

Send DM

Send DMs with POST /v3/twitter/send-dm.

Testing checklist

  • Use the n8n Test Step action on each HTTP Request or TwexAPI node.
  • Confirm every REST request includes Authorization: Bearer YOUR_API_KEY.
  • Confirm every MCP Client Tool request includes x-api-key.
  • For paginated jobs, store next_cursor after each page.
  • On 429, wait before retrying and preserve the cursor.

n8n Twitter automation questions

How do I connect n8n to Twitter through TwexAPI?

Install the TwexAPI community node or create Header Auth with Authorization: Bearer YOUR_API_KEY. Select it on every TwexAPI request.

How does n8n Twitter search work?

Call POST /twitter/advanced_search/page through the community node or HTTP Request. Store the query and cursor for every page.

Can n8n post to Twitter?

Yes, through POST /twitter/tweets/create. Write actions need a cookie or auth_token. Preview payloads with the CLI first.

Can I build an n8n Twitter agent?

Yes. An n8n Twitter agent can search tweets, profiles, and trends through MCP at https://api.twexapi.io/mcp.

Can self-hosted n8n use TwexAPI?

Yes. Allow outbound HTTPS to https://api.twexapi.io.

Next steps

  • Read Agent MCP Handoff for strict JSON handoff patterns.
  • Read CLI for dry-run previews of write actions.
  • Use MCP Tools when building AI Agent workflows.

Was this page helpful?