DocsForAI Social Buddy avatar
DocsForAI Social Buddy

Pricing

from $0.01 / 1,000 results

Go to Apify Store
DocsForAI Social Buddy

DocsForAI Social Buddy

DocsForAI Social Buddy

Pricing

from $0.01 / 1,000 results

Rating

0.0

(0)

Developer

Pratik Parmar

Pratik Parmar

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

0

Monthly active users

4 days ago

Last modified

Categories

Share

🚀 Social Media Post Generator (DocsForAI)

Transform your blog posts and tutorials into engaging X (Twitter) posts with AI-generated images!

This Apify Actor uses Google Gemini AI to create compelling social media content and Flux.2 to generate eye-catching visuals from your markdown content. Perfect for developers, technical writers, and content creators who want to promote their work on social media.

Built with:

  • 🤖 Google Gemini 2.5 Pro for content generation
  • 🎨 Flux.2 dev model for image generation
  • 🐦 X (Twitter) API v2 for auto-posting
  • ⚡ Apify SDK for Python

✨ Features

  • 🤖 AI-Powered Content Generation - Uses Google Gemini 2.5 Pro to create engaging posts (max 240 characters)
  • 🎨 AI Image Generation - Creates professional visuals using Flux.2 dev model
  • 🐦 Auto-Post to X (Twitter) - Optionally publishes your content directly to X with images
  • 💰 Pay-Per-Event Pricing - Flexible monetization with charges for post generation, image creation, and X posting
  • 📊 Structured Output - Saves results to dataset with base64 images for easy viewing
  • 🔐 Secure Credentials - API keys stored securely as secrets

🚀 How it works

  1. Input: Provide your markdown blog/tutorial content
  2. AI Analysis: Gemini AI analyzes the content and creates:
    • A compelling X post (strictly under 240 characters)
    • A detailed image generation prompt
  3. Image Generation: Flux.2 creates a professional image based on the prompt
  4. Storage: Saves the post content and image to Apify's dataset and key-value store
  5. Publishing (Optional): Posts to X (Twitter) with the generated image

📥 Input Parameters

ParameterTypeRequiredDescription
markdownContentstring✅ YesYour blog or tutorial content in markdown format
postToXboolean❌ NoEnable automatic posting to X (Twitter). Default: false
xApiKeystring⚠️ If postingYour X API Key (Consumer Key)
xApiSecretKeystring⚠️ If postingYour X API Secret Key (Consumer Secret)
xAccessTokenstring⚠️ If postingYour X Access Token
xAccessTokenSecretstring⚠️ If postingYour X Access Token Secret

📤 Output

The Actor outputs a dataset with the following fields:

  • postContent - Generated X post text (max 240 chars)
  • imageBase64 - Base64-encoded image for display
  • imageUrl - URL to the image in key-value store
  • imageKey - Unique UUID filename of the image
  • markdownPreview - First 200 characters of source content
  • tweetUrl - Direct link to posted tweet (if postToX enabled)
  • tweetId - X post ID (if posted)
  • posted - Boolean indicating if posting succeeded

💵 Pricing

This Actor uses pay-per-event pricing:

  • Post Generation: $0.10 per post
  • Image Generation: $0.10 per image
  • X Posting: $0.10 per post (when enabled)

Total per run: $0.20 (without X posting) or $0.30 (with X posting)

🔑 Getting X API Credentials

To enable posting to X:

  1. Go to developer.x.com
  2. Create a new app or use an existing one
  3. Navigate to your app's "Keys and tokens" section
  4. Generate and copy:
    • API Key (Consumer Key)
    • API Secret Key (Consumer Secret)
    • Access Token
    • Access Token Secret
  5. Ensure your app has Read and Write permissions

🧪 Testing Locally

Basic Test (Without X Posting)

# Install dependencies
uv pip install -r requirements.txt
# Run the Actor
apify run

Test with X Posting

  1. Update storage/key_value_stores/default/INPUT.json:
{
"markdownContent": "# Your Blog Title\n\nYour content here...",
"postToX": true,
"xApiKey": "your_api_key",
"xApiSecretKey": "your_api_secret",
"xAccessToken": "your_access_token",
"xAccessTokenSecret": "your_access_token_secret"
}
  1. Run:
$apify run

Test Pay-Per-Event Charging

$ACTOR_TEST_PAY_PER_EVENT=true apify run

This logs charging events to storage/datasets/charging-log/

📋 Example Usage

Input Example

{
"markdownContent": "# Getting Started with Web Scraping\n\nLearn how to build powerful web scrapers...",
"postToX": false
}

Output Example

{
"postContent": "🚀 New tutorial: Master web scraping with Python! Learn to extract data at scale, monitor competitors & build ML datasets. Perfect for beginners! #WebScraping #Python #DataScience",
"imageBase64": "iVBORw0KGgoAAAANSUhEUgAA...",
"imageUrl": "https://api.apify.com/v2/key-value-stores/abc123/records/uuid.png",
"imageKey": "550e8400-e29b-41d4-a716-446655440000.png",
"markdownPreview": "# Getting Started with Web Scraping\n\nWeb scraping is the process of extracting data from websites automatically...",
"tweetUrl": null,
"tweetId": null,
"posted": false
}

📂 Check Results

After running:

# View the output
cat storage/datasets/default/000000001.json | jq
# Find generated images
ls storage/key_value_stores/default/*.png
# View post content only
cat storage/datasets/default/000000001.json | jq '.postContent'

🚀 Deploy to Apify

Method 1: Connect Git Repository

  1. Go to Actor creation page
  2. Click on Link Git Repository button
  3. Connect your GitHub repository
  4. Configure pay-per-event pricing in Actor settings:
    • Event: post-generation → Price: $0.10
    • Event: image-generation → Price: $0.10
    • Event: x-post → Price: $0.10

Method 2: Push from Local Machine

  1. Login to Apify:

    $apify login
  2. Deploy your Actor:

    $apify push
  3. Configure Pricing in the Apify Console:

    • Go to your Actor → Settings → Monetization
    • Select "Pay-per-event" pricing model
    • Add the three events with their prices

After Deployment

The Actor will be available at: https://console.apify.com/actors/<your-actor-id>

Users can run it via:

🔧 Dependencies

  • apify - Apify SDK for Python
  • requests - HTTP library for API calls
  • google-genai - Google Gemini AI SDK
  • tweepy - X (Twitter) API client
  • crawlee - Web scraping framework

📚 Documentation & Resources

Actor-Specific

Apify Platform

⚠️ Important Notes

  • Character Limit: Posts are strictly limited to 240 characters for X compatibility
  • X API Access: Requires X Developer account with Elevated access to post tweets
  • Rate Limits: Be mindful of X API rate limits when posting frequently
  • Credentials Security: All API keys are marked as secrets in the input schema
  • Local Testing: Charging events are logged but not processed when running locally

🤝 Contributing

Feel free to submit issues, create pull requests, or suggest improvements!

📄 License

This Actor is provided as-is under the Apify platform terms.