LangChain Social Media Posting
A LangChain agent can post to social media by calling the Schedule & Chill REST API from a @tool function, or by loading the MCP server through langchain-mcp-adapters. Either path gives the agent scheduling, media, and queue tools across X, LinkedIn, Facebook, Instagram, YouTube, TikTok, and Pinterest without writing platform OAuth code.
Last updated July 26, 2026
Quick Answer
LangChain + Schedule & Chill in one line
Two paths: a ~15-line @tool wrapping POST /api/posts, or langchain-mcp-adapters pointed at the MCP endpoint for all 10 tools at once.
How to connect LangChain
10 minutes from API key to first post
1
Create an API key
Settings → API Keys in Schedule & Chill. Store it as SCHEDULENCHILL_API_KEY in your environment, not in code.
2
Pick your path
For one narrow capability, write a @tool that wraps POST /api/posts. For a full agent that browses media and manages a queue, load the MCP server instead — you get every tool without writing wrappers.
3
Fetch account ids once
Call GET /api/capabilities at startup and cache the connected account ids, so the model picks from a known list instead of hallucinating ids.
4
Bind the tools to your agent
Pass the tool list into create_react_agent (LangGraph) or your AgentExecutor. Keep the docstring precise — it is the only thing the model reads to decide when to post.
5
Gate the destructive path
Publishing is irreversible. Default the tool to scheduling with a future timestamp, and require a human approval step before publish_now.
Python — a schedule_post tool
Copy this into your LangChain setup and replace the ids with your own.
import os
import requests
from langchain_core.tools import tool
API = "https://schedulenchill.com/api"
HEADERS = {
"Authorization": f"Bearer {os.environ['SCHEDULENCHILL_API_KEY']}",
"Accept": "application/json",
}
@tool
def schedule_post(content: str, account_ids: list[int], scheduled_at: str) -> dict:
"""Schedule a social media post.
content: the post text (keep under 280 chars if targeting X).
account_ids: connected account ids to publish to.
scheduled_at: ISO 8601 UTC timestamp in the future, e.g. 2026-08-01T14:00:00Z.
"""
response = requests.post(
f"{API}/posts",
headers=HEADERS,
json={
"content": content,
"social_account_ids": account_ids,
"scheduled_at": scheduled_at,
},
timeout=30,
)
response.raise_for_status()
return response.json()
# Or load every MCP tool at once:
# from langchain_mcp_adapters.client import MultiServerMCPClient
# client = MultiServerMCPClient({
# "schedulenchill": {
# "url": "https://schedulenchill.com/mcp",
# "transport": "streamable_http",
# "headers": HEADERS,
# }
# })
# tools = await client.get_tools()What LangChain can do
- Schedule or publish from inside an agent loop
- Load all 10 MCP tools at once with langchain-mcp-adapters
- Per-platform copy so one idea adapts to X and LinkedIn
- Browse and attach media library assets
- Read the queue so the agent knows what is already planned
- Cancel a scheduled post the agent decides against
What to know first
- There is no first-party langchain-schedulenchill package. You write the @tool wrapper, or use the MCP adapter, which is maintained by LangChain.
- Publishing cannot be undone once a platform accepts the post. Prefer scheduling with a delay so a human can cancel.
- Account ids are workspace-specific. Fetch them at runtime instead of hardcoding them in a prompt.
What teams build with it
Common LangChain workflows that end in a published post
Research-and-post agent
The agent reads your docs or a news feed, drafts a take, checks the existing queue for overlap, then schedules it for the next open slot.
Multi-agent content team
A LangGraph writer node drafts, an editor node critiques, and a publisher node calls schedule_post only after the editor approves.
Customer-facing social features
Your SaaS embeds an agent that lets your own users publish to their accounts, with Schedule & Chill handling every platform OAuth flow.
Frequently asked questions
LangChain and social posting — what builders ask
Wire LangChain up today
Start your free trial, generate an API key, and make your first call in minutes. Card required, cancel anytime.
Start Free Trial7-day free trial · Card required · Cancel anytime