Guides

How to Connect X (Twitter) to Your AI Agents

Step-by-step guide to connecting your X (Twitter) account to Orqestr so AI agents can post tweets, reply, like, retweet, search, and send DMs on your behalf.

April 10, 20267 min

You can connect your X (Twitter) account to Orqestr and let AI agents post tweets, reply to conversations, search for mentions, like posts, send DMs, and more - all as part of automated workflows. See the full X integration changelog for a complete summary of what shipped.

This guide walks through the full setup: creating an X developer app, getting your API credentials, connecting to Orqestr, and assigning the integration to an agent.

What you will need

  • An X (Twitter) account
  • Access to the X Developer Portal (free tier works)
  • An Orqestr project with at least one agent

Step 1: Create an X Developer App

If you do not already have a developer app on X, go to the X Developer Portal and create a new project and app.

Give your app a name that makes sense for your use case — something like "Orqestr Agent" or your company name.

Step 2: Configure app permissions

By default, new X apps only have read access. Your agents need read and write to post tweets, like, retweet, and send DMs.

  1. In the Developer Portal, go to your app's Settings
  2. Scroll to User authentication settings and click Set up
  3. X will ask you to fill in app information:
FieldWhat to enter
App permissionsRead and write
Type of AppWeb App, Automated App or Bot
Callback URIYour app URL (e.g. https://app.orqestr.ai) — this is not used, but required by X
Website URLYour website or app URL
  1. Save the settings

Step 3: Generate your API credentials

You need four credentials to connect. All four are found in the Developer Portal under your app's Keys and Tokens section.

API Key and API Secret

These are your app-level credentials. They were generated when you created the app.

  1. Go to your app → Keys and Tokens
  2. Under Consumer Keys, find your API Key and API Key Secret
  3. If you need to regenerate them, click Regenerate (this invalidates the old ones)

Access Token and Access Token Secret

These are your user-level credentials that grant the agent permission to act as your X account.

  1. On the same Keys and Tokens page, scroll to Authentication Tokens
  2. Click Generate under Access Token and Secret
  3. Make sure the access level shows Read and Write — if it shows Read Only, go back to Step 2 and update your app permissions first, then regenerate

Warning

Copy all four values immediately. X only shows the secrets once. If you lose them, you will need to regenerate.

Step 4: Connect X in Orqestr

  1. Open your Orqestr project
  2. Go to Integrations in the sidebar
  3. Find X (Twitter) in the grid and click it
  4. Enter the four credentials:
    • API Key (Consumer Key)
    • API Secret (Consumer Secret)
    • Access Token
    • Access Token Secret
  5. The Bearer Token field is optional — only needed if you want to receive real-time webhook events (for event triggers)
  6. Click Connect X (Twitter)

Orqestr encrypts your credentials at rest and never exposes them in the UI after saving.

Step 5: Assign to an agent

The connection exists in your project, but agents do not have access until you explicitly grant it.

  1. Go to Agents in the sidebar
  2. Edit the agent you want to use X with (or create a new one)
  3. In the agent form, scroll to the Integrations section
  4. Check the X (Twitter) connection
  5. Optionally configure per-tool permissions (allow, require approval, or disable specific tools)
  6. Save the agent

Available tools

Once connected, your agent has access to 14 X tools:

ToolWhat it does
post_tweetPost a new tweet (up to 280 characters), with optional reply-to or quote
delete_tweetDelete a tweet by ID
get_tweetGet a tweet with author info and engagement metrics
search_tweetsSearch recent tweets (last 7 days) using X search syntax
like_tweetLike a tweet
unlike_tweetRemove a like
retweetRetweet a tweet
unretweetUndo a retweet
get_userLook up a user by username
get_user_tweetsGet recent tweets from a specific user
send_dmSend a direct message
follow_userFollow a user
unfollow_userUnfollow a user
get_meGet the authenticated account's profile

These tools appear namespaced as x_post_tweet, x_search_tweets, etc. in the agent's tool list.

Example workflows

Automated social presence

Create a content agent with a system prompt like:

You are a social media manager for a B2B SaaS startup. You post 3-5 tweets per week about product updates, industry insights, and useful tips. Your tone is professional but approachable. Never use hashtags excessively. Always be authentic.

Set up a recurring schedule (e.g. every Monday, Wednesday, Friday) with input like "Write and post a tweet about [topic]." The agent drafts and posts directly.

Competitor monitoring

Pair the X integration with web_search and resolve_link:

  1. A research agent searches X for mentions of your competitors using search_tweets
  2. It compiles a summary of what people are saying
  3. A response agent drafts thoughtful replies to relevant conversations

Community engagement

A support agent monitors mentions and replies to common questions:

  1. Use search_tweets with a query like to:yourhandle or @yourhandle
  2. Agent reads the tweets, checks your knowledge base for answers
  3. Posts replies using post_tweet with reply_to_tweet_id

Optional: Webhook events for triggers

If you also want to receive real-time events from X (new mentions, DMs, follows), provide the Bearer Token when connecting. This registers a webhook with X and lets you create event triggers that automatically spawn tasks when specific events occur. The X webhook integration changelog covers the details.

This is optional — you can use all 14 API tools without a webhook.

Troubleshooting

"Read Only" access token — Go to your app settings in the X Developer Portal, update User Authentication Settings to Read and Write, then regenerate your Access Token and Secret.

401 errors — Double-check that you copied all four credentials correctly. API Key and Access Token are different values.

Rate limits — X enforces rate limits per endpoint. The free tier allows around 50 tweets per 24 hours. If your agent hits limits, it will receive an error and can retry later.

Connection test fails — Use the "Test" button on the connection detail panel in Orqestr. It calls get_me to verify your API credentials are valid.

Connect X and automate your social presence

No credit card required. Free plan included.

Start building for free →