# Twitter Poster (`pixelated_pulse/twitter-poster`) Actor

Automatically post tweets to Twitter with ease!

- **URL**: https://apify.com/pixelated_pulse/twitter-poster.md
- **Developed by:** [Pixelated Pulse](https://apify.com/pixelated_pulse) (community)
- **Categories:** Social media, Agents, Integrations
- **Security:** Full permissions
- **Stats:** 47 total users, 1 monthly users, 90.9% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Twitter Poster Actor

Automatically post tweets to Twitter with ease! This powerful Actor supports both Twitter API and browser automation methods, giving you flexibility and reliability for your social media automation needs.

### 🚀 Key Features

- **🐦 Dual Posting Methods**: Choose between Twitter API (fast & reliable) or browser automation (no API limits)
- **️ Robust Error Handling**: Comprehensive logging and error reporting
- **📊 Detailed Results**: Complete success/failure tracking in your dataset

### 💡 Perfect For

- **Social Media Managers**: Schedule and automate tweet posting
- **Content Creators**: Distribute content across multiple accounts
- **Marketers**: Execute social media campaigns at scale
- **Developers**: Integrate Twitter posting into your applications
- **Businesses**: Automate customer communications and updates

### 🔧 Two Posting Methods

#### Method 1: Twitter API

- ✅ **Fastest and most reliable**
- ✅ **Official Twitter integration**
- ⚠️ **Requires Twitter API credentials**

#### Method 2: Browser Automation

- ✅ **No API limits or restrictions**
- ✅ **Works with any Twitter account**
- ✅ **Simple authentication token setup**
- ⚠️ **Slower than API method**

### 📝 Input Configuration

#### Required for All Posts

- **Tweet Text**: Your message (max 280 characters)
- **Posting Method**: Choose "api" or "browser"

#### For API Method

You'll need Twitter API credentials:

- **API Key** (`twitterApiKey`): Your Consumer Key
- **API Secret** (`twitterApiSecret`): Your Consumer Secret
- **Access Token** (`twitterAccessToken`): Your Access Token
- **Access Token Secret** (`twitterAccessSecret`): Your Access Token Secret

[Get your Twitter API credentials here →](https://developer.twitter.com/)

#### For Browser Method

You'll need your Twitter authentication token:

- **Auth Token** (`twitterAuthToken`): Your Twitter auth_token cookie value

**How to get your auth token:**

1. Log into Twitter in your browser
2. Open Developer Tools (F12)
3. Go to Application/Storage → Cookies → x.com
4. Find the "auth_token" cookie and copy its value

### 💻 Usage Examples

#### Post with Twitter API

```json
{
  "tweetText": "Hello world! Posting via API 🚀 #automation",
  "postingMethod": "api",
  "twitterApiKey": "your_api_key_here",
  "twitterApiSecret": "your_api_secret_here",
  "twitterAccessToken": "your_access_token_here",
  "twitterAccessSecret": "your_access_token_secret_here"
}
```

#### Post with Browser Automation

```json
{
  "tweetText": "Hello world! Posting via browser 🤖 #automation",
  "postingMethod": "browser",
  "twitterAuthToken": "your_auth_token_cookie_value_here"
}
```

### 📊 Results & Output

Every run provides detailed results in your Apify dataset:

**Successful Post:**

```json
{
  "success": true,
  "method": "api",
  "tweetText": "Your tweet content",
  "tweetId": "1234567890123456789",
  "tweetUrl": "https://x.com/i/web/status/1234567890123456789",
  "timestamp": "2025-09-10T10:30:00.000Z"
}
```

**Failed Post:**

```json
{
  "success": false,
  "method": "browser",
  "tweetText": "Your tweet content",
  "error": "Detailed error description",
  "timestamp": "2025-09-10T10:30:00.000Z"
}
```

### 🚨 Troubleshooting

#### Common Issues & Solutions

**API Method Issues:**

- `Unauthorized`: Double-check your API credentials
- `Forbidden`: Ensure your Twitter app has write permissions
- `Rate limit exceeded`: Wait before retrying or reduce posting frequency

**Browser Method Issues:**

- `Authentication failed`: Get a fresh auth_token from your browser
- `Token expired`: Refresh your browser session and get a new token
- `Timeout errors`: Twitter's interface may have changed - contact support

### 🌟 Why Choose This Actor?

- ✅ **Battle-tested**: Used in production for years
- ✅ **Regularly updated**: Maintained and improved continuously
- ✅ **Flexible**: Works with your existing Twitter setup
- ✅ **Reliable**: Built-in error handling and retry logic
- ✅ **Scalable**: From single tweets to high-volume campaigns

***

**Ready to automate your Twitter posting?** Click "Try for free" and start posting tweets in minutes!

*This Actor respects Twitter's Terms of Service and rate limits. Use responsibly for legitimate automation needs.*

# Actor input Schema

## `tweetText` (type: `string`):

The text content of the tweet to post

## `postingMethod` (type: `string`):

Choose how to post the tweet

## `twitterApiKey` (type: `string`):

Your Twitter app's API key. Required when using API posting method.

## `twitterApiSecret` (type: `string`):

Your Twitter app's API secret. Required when using API posting method.

## `twitterAccessToken` (type: `string`):

Your Twitter access token. Required when using API posting method.

## `twitterAccessSecret` (type: `string`):

Your Twitter access token secret. Required when using API posting method.

## `twitterAuthToken` (type: `string`):

Your Twitter auth_token cookie value. Required when using browser posting method. You can get this from your browser's developer tools when logged into Twitter.

## Actor input object example

```json
{
  "tweetText": "Hello world! This is my first automated tweet.",
  "postingMethod": "browser",
  "twitterAuthToken": "your_auth_token_cookie_value_here"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "tweetText": "🚀 Just automated my first tweet using the Twitter Poster Actor! This is amazing for social media automation. #TwitterAutomation #SocialMedia #Apify",
    "postingMethod": "browser",
    "twitterAuthToken": "your_auth_token_cookie_value_here"
};

// Run the Actor and wait for it to finish
const run = await client.actor("pixelated_pulse/twitter-poster").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "tweetText": "🚀 Just automated my first tweet using the Twitter Poster Actor! This is amazing for social media automation. #TwitterAutomation #SocialMedia #Apify",
    "postingMethod": "browser",
    "twitterAuthToken": "your_auth_token_cookie_value_here",
}

# Run the Actor and wait for it to finish
run = client.actor("pixelated_pulse/twitter-poster").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "tweetText": "🚀 Just automated my first tweet using the Twitter Poster Actor! This is amazing for social media automation. #TwitterAutomation #SocialMedia #Apify",
  "postingMethod": "browser",
  "twitterAuthToken": "your_auth_token_cookie_value_here"
}' |
apify call pixelated_pulse/twitter-poster --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pixelated_pulse/twitter-poster"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7XW2l7ET9i5HXmkm3/builds/7ZySF0YETqrF1LMQx/openapi.json
