Skip to content

About

LangChain tools to publish, schedule and track social media posts on TikTok, Instagram, YouTube, LinkedIn, X and more via Upload-Post

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

langchain-upload-post

PyPI - Version License: MIT

LangChain tools for Upload-Post: let an agent publish, schedule and track social media posts on TikTok, Instagram, YouTube, LinkedIn, Facebook, X, Threads, Pinterest, Bluesky, Discord, Telegram, Google Business and more, with a single API.

Built on the official upload-post Python SDK.

Installation

pip install -U langchain-upload-post

Credentials

Create an account at upload-post.com, connect your social accounts to a profile, and generate an API key in the dashboard. Then set:

export UPLOAD_POST_API_KEY="your-api-key"
export UPLOAD_POST_PROFILE="my-profile"   # optional: default profile to post from

Both values can also be passed explicitly: UploadPostToolkit(api_key="...", profile="my-profile").

Tools

Tool Name What it does
UploadPostVideo upload_post_video Publish or schedule a video from a public URL
UploadPostPhotos upload_post_photos Publish or schedule one or more photos / a carousel from public URLs
UploadPostText upload_post_text Publish or schedule a text post
UploadPostStatus upload_post_status Status of an upload by request_id or job_id
UploadPostScheduledPosts upload_post_scheduled_posts List scheduled posts
UploadPostHistory upload_post_history Upload history, filterable by platform, status, profile and date
UploadPostListProfiles upload_post_list_profiles Profiles and their connected social accounts
UploadPostAnalytics upload_post_analytics Account analytics per platform

UploadPostToolkit returns all of them sharing one API client. UploadPostToolkit(read_only=True) returns only the five tools that never publish anything.

Use with an agent

# pip install -U langchain-upload-post "langchain[anthropic]"
from langchain.agents import create_agent

from langchain_upload_post import UploadPostToolkit

tools = UploadPostToolkit(profile="my-profile").get_tools()

agent = create_agent(
    model="anthropic:claude-sonnet-4-6",
    tools=tools,
    system_prompt=(
        "You manage social media through Upload-Post. Check the connected "
        "accounts before publishing and confirm the platforms with the user."
    ),
)

result = agent.invoke(
    {
        "messages": [
            {
                "role": "user",
                "content": (
                    "Post https://example.com/launch.mp4 to TikTok and Instagram "
                    "tomorrow at 18:00 Madrid time with the caption "
                    "'We just launched!' and then show me my scheduled posts."
                ),
            }
        ]
    }
)
print(result["messages"][-1].content)

Use a tool directly

from langchain_upload_post import UploadPostText, UploadPostStatus

text = UploadPostText(profile="my-profile")
print(text.invoke({"text": "Hello from LangChain!", "platforms": ["x", "linkedin"]}))

status = UploadPostStatus()
print(status.invoke({"request_id": "..."}))

Every tool returns the API response as a JSON string. API errors are returned to the model as the tool result (instead of raising) so the agent can react to them.

Platform-specific options

The publish tools expose the common fields (caption, description, schedule, queue, first comment). Any other field documented in the Upload-Post API reference can be passed through platform_options:

from langchain_upload_post import UploadPostVideo

UploadPostVideo(profile="my-profile").invoke(
    {
        "video": "https://example.com/clip.mp4",
        "platforms": ["youtube", "tiktok"],
        "title": "Behind the scenes",
        "platform_options": {
            "privacyStatus": "unlisted",       # YouTube
            "tags": ["bts", "making-of"],      # YouTube
            "privacy_level": "SELF_ONLY",      # TikTok
            "tiktok_title": "BTS #makingof",   # per-platform caption
        },
    }
)

Local files (off by default)

By default the publish tools only accept public http(s) URLs for media: a local path is rejected with an error the model can read. This stops a model (or a prompt injection) from uploading arbitrary files from the machine the agent runs on.

If you run the agent in a trusted, single-user environment and want it to publish files from disk, turn local paths on explicitly:

UploadPostToolkit(allow_local_files=True)
# or per tool / per wrapper:
UploadPostVideo(allow_local_files=True)
UploadPostAPIWrapper(allow_local_files=True)

Development

uv sync --group test
uv run pytest tests/unit_tests --disable-socket --allow-unix-socket
# integration tests hit the real API (read-only endpoints only):
UPLOAD_POST_API_KEY=... UPLOAD_POST_PROFILE=... uv run pytest tests/integration_tests

Links

License

MIT

About

LangChain tools to publish, schedule and track social media posts on TikTok, Instagram, YouTube, LinkedIn, X and more via Upload-Post

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages