Skip to main content

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

License

MIT

Release files for langchain-upload-post 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-upload-post 0.1.0
File Size Uploaded
langchain_upload_post-0.1.0.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-upload-post 0.1.0
File Interpreter ABI Platform
langchain_upload_post-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.6 kB

Release files / langchain_upload_post-0.1.0.tar.gz

Download URL langchain_upload_post-0.1.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
27c5a48b39a9099c8b600615b1c5c0e077ae892182a1eb0fa6008ff76dbfa329
BLAKE2b-256 checksum
How to use checksums
5174b406d8e57bbc28ac739ad443f1b2465622f80ea804a471ef04cf30cc483b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / langchain_upload_post-0.1.0-py3-none-any.whl

Download URL langchain_upload_post-0.1.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df79f6a2d1d5934784b2101ae626ef6f1390049de8b2cf887632c4485a3ba1a2
BLAKE2b-256 checksum
How to use checksums
1425e9aac38258bc3bb4333714848ead91fc38325528c07c7bc4b0ddda8f5de7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page