Schedule from a spreadsheet (Python)
Plan in a spreadsheet, export it as CSV, schedule it all at once. Uses requests.
when,channels,text2027-01-19T09:00:00+01:00,threads instagram,Cardamom buns are back on Saturday.2027-01-21T17:30:00+01:00,facebook,Late opening on Thursday: until 8.when carries its offset, so it means one moment wherever the script runs. channels names
Networks, separated by spaces.
import csvimport os
import requests
API = "https://app.pubrivo.com/api"session = requests.Session()session.headers["Authorization"] = f"Bearer {os.environ['PUBRIVO_KEY']}"
channels = session.get(f"{API}/channels").json()["data"]by_network = {}for channel in channels: by_network.setdefault(channel["network"], []).append(channel["id"])
with open("posts.csv", newline="") as file: for row in csv.DictReader(file): ids = [i for network in row["channels"].split() for i in by_network.get(network, [])] response = session.post( f"{API}/posts", json={"text": row["text"], "channelIds": ids, "scheduledAt": row["when"]}, ) body = response.json() if response.ok: print("scheduled", body["data"]["id"], row["when"]) else: print("refused", row["when"], body["error"]["message"]) for blocker in body["error"].get("blockers", []): print(" -", blocker["message"])PUBRIVO_KEY=pbv_… python schedule.pyRun it twice by accident within 10 minutes and nothing doubles: each repeated row comes back as the Post it already made.