Daily
Publish planned posts to Instagram and Facebook with email results
Your planned posts go out on Instagram and your Facebook Page at their scheduled times, and you get an email for each success or failure.
- Runs
- Daily
- Apps
- Facebook Pages, Gmail
- AI
- Not needed
- Access
- instagram_content_publish, pages_manage_posts; gmail.send
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, publish the next planned post that's due to Instagram and my Facebook Page, and email me whether it worked.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A boutique plans product photos for Instagram and Facebook a week ahead. When posting fails, because of an expired login or a wrong image size, nobody notices until a customer asks why the new collection wasn't announced.
Each planned post now goes out on time on both networks, and every result is emailed: a confirmation with links when it works, and the reason when it doesn't, so problems are fixed the same day.
What you get out of it
Posts go out on time
No one needs to be online when a post is due.
Failures don't go unnoticed
An email tells you straight away if something didn't post, and why.
Both networks at once
Instagram and Facebook get the same post.
A record of every post
Confirmation emails show what went out and when.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime looks for the next planned post that's due.
It prepares the image on Instagram and publishes it, then posts it to your Facebook Page.
The post is marked as done, or as failed with the reason.
You get an email with the result and links.
Before it runs live
- Connect Facebook Pages
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Facebook Pages and Gmail steps into one automation
Under the hood
The code that runs this automation
import base64
from datetime import datetime, timezone
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state
PAGE_ID, IG_ID, G = "1234567890", "17841400000000000", "https://graph.facebook.com/v21.0"
@on_trigger
def run(event):
plan = state.get("plan") or []
due = next((p for p in plan if not p.get("status") and p["time"] <= datetime.now(timezone.utc).isoformat()), None)
if not due:
return {"posted": False}
t = {"access_token": credentials.connection("facebook", "work")}
try:
c = http.post(f"{G}/{IG_ID}/media", data={**t, "image_url": due["image"], "caption": due["caption"]}).json()["id"]
ig = http.post(f"{G}/{IG_ID}/media_publish", data={**t, "creation_id": c}).json()["id"]
fb = http.post(f"{G}/{PAGE_ID}/photos", data={**t, "url": due["image"], "caption": due["caption"]}).json()["id"]
due["status"], body = "done", f"Published. Instagram {ig}, Facebook {fb}."
except Exception as e:
due["status"], body = "failed", f"Failed: {e}"
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
raw = f"To: me\r\nSubject: Post {due['status']}: {due['caption'][:60]}\r\n\r\n{body}"
gmail.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(raw.encode()).decode()}).execute()
state.set("plan", plan)
return {"status": due["status"]}FAQ
Common questions
Where do I plan posts?
Why might a post fail?
Does a failed post retry?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Publish AI posts to your Page with an email record
AI writes and publishes a Facebook post from your topic list, and you get an email with the text and link of what went out.
See how it worksApprove trend-based Facebook posts from your inbox
AI drafts posts about trending topics in your field and emails them to you; the ones you approve are published to your Page.
See how it worksGet a Meta Ads report with commentary by email
Each Monday you get an email with last week's Meta ad results by campaign and a few lines on what they mean.
See how it worksKeep exploring
Set up “Publish planned posts to Instagram and Facebook with email results” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.