All Toolsโ€บSocial Media Post Builder
๐Ÿ”ง Generative AI for BusinessMay 21, 2026โœ… Tests passing

Social Media Post Builder

A Python library and CLI enabling users to generate engaging social media posts for business marketing campaigns. Users can specify the platform, audience type, and key message, and the tool uses generative AI to craft tailored posts optimized for the selected platform.

What It Does

  • Generate platform-specific social media posts (e.g., Twitter, LinkedIn, Facebook)
  • Customize posts for different audience types (e.g., B2B, tech enthusiasts)
  • Support for various tones (e.g., professional, casual, friendly)
  • Option to batch-generate posts for campaigns

Installation

  • Python 3.8+
  • openai==0.27.0
  • typer==0.9.0
  • jinja2==3.1.2

Usage

CLI Example

Generate a post for Twitter:

python social_post_builder.py --platform "Twitter" --audience "tech enthusiasts" --message "new feature release"

Save the generated post to a file:

python social_post_builder.py --platform "LinkedIn" --audience "B2B" --message "launch new product" --output-file "post.txt"

Library Example

Use the tool as a library in your Python code:

from social_post_builder import generate_post

post = generate_post("Twitter", "tech enthusiasts", "casual", "new feature release")
print(post)

Source Code

import openai
import typer
from jinja2 import Template
from typing import Optional

def generate_post(platform: str, audience: str, tone: str, message: str) -> str:
    """Generates a social media post using OpenAI's API."""
    prompt_template = Template(
        """
        Write a {{ tone }} social media post for {{ platform }} targeting {{ audience }}. The key message is: "{{ message }}".
        """
    )

    prompt = prompt_template.render(platform=platform, audience=audience, tone=tone, message=message)

    try:
        response = openai.Completion.create(
            engine="text-davinci-003",
            prompt=prompt,
            max_tokens=100
        )
        return response.choices[0].text.strip()
    except Exception as e:
        raise RuntimeError(f"Failed to generate post: {e}")

def main(
    platform: str = typer.Option(..., help="Platform for the post (e.g., Twitter, LinkedIn)"),
    audience: str = typer.Option(..., help="Target audience (e.g., B2B, tech enthusiasts)"),
    tone: str = typer.Option("professional", help="Tone of the post (e.g., professional, casual)"),
    message: str = typer.Option(..., help="Key message for the post"),
    output_file: Optional[str] = typer.Option(None, help="File to save the generated post")
):
    """CLI entry point for generating social media posts."""
    try:
        post = generate_post(platform, audience, tone, message)
        if output_file:
            with open(output_file, "w") as file:
                file.write(post)
            typer.echo(f"Post saved to {output_file}")
        else:
            typer.echo("Generated Post:")
            typer.echo(post)
    except RuntimeError as e:
        typer.echo(f"Error: {e}", err=True)

if __name__ == "__main__":
    typer.run(main)

Community

Downloads

ยทยทยท

Rate this tool

No ratings yet โ€” be the first!

Details

Tool Name
social_post_builder
Category
Generative AI for Business
Generated
May 21, 2026
Tests
Passing โœ…

Quick Install

Clone just this tool:

git clone --depth 1 --filter=blob:none --sparse \
  https://github.com/ptulin/autoaiforge.git
cd autoaiforge
git sparse-checkout set generated_tools/2026-05-21/social_post_builder
cd generated_tools/2026-05-21/social_post_builder
pip install -r requirements.txt 2>/dev/null || true
python social_post_builder.py
Social Media Post Builder โ€” AI Tools by AutoAIForge