Every hour
Write social captions for new WordPress posts in a sheet
Each time you publish a blog post, captions for LinkedIn, X and Facebook are written and added to your social queue sheet, ready to schedule.
- Runs
- Every hour
- Apps
- Google Sheets, WordPress
- AI
- Yes, uses the built-in AI allowance
- Access
- WordPress read; Sheets edit
Send this to your assistant
Create a ClickRuntime automation: every hour, find newly published WordPress posts, write captions for LinkedIn, X and Facebook for each, and add them to my Social queue sheet.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A nonprofit's communications officer publishes two or three blog posts a week and is supposed to share each one on social media. Writing three versions of a caption for every post is the step that gets dropped, so many articles are published and never promoted.
This automation writes the captions as soon as a post goes live. Every hour it checks WordPress for new posts, AI writes a caption for each network, and they are added to the Social queue sheet with the post link. The officer copies them into their scheduling tool or a volunteer posts them by hand.
What you get out of it
Every post gets promoted
Captions appear for every article without anyone remembering to write them. Posts reach more readers because they are actually shared.
Right length for each network
LinkedIn, X and Facebook each get a caption that suits their style and limits. No more trimming one caption three ways.
A queue anyone can work from
The sheet holds captions, links and dates in one place. Volunteers or colleagues can schedule posts without asking what to say.
Nothing is posted without a person
Captions go into a sheet, not straight onto your accounts. Someone always chooses when and where each one goes out.
How it works
What happens, step by step
Every hour, ClickRuntime checks your WordPress site for posts published since its last check.
It remembers the time of the newest post it has handled, so each post is only processed once.
AI writes a caption for LinkedIn, X and Facebook from each post's title and excerpt.
The captions are added as a new row in your Social queue sheet, along with the post title, link and date.
Before it runs live
- Connect your Google Sheets account and pick the spreadsheets it may use
- Connect WordPress
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
- Act only on the items that match your own rules, and skip the rest
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Google Sheets and WordPress steps into one automation
Under the hood
The code that runs this automation
from datetime import datetime, timezone
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched
SHEET_ID = "your-spreadsheet-id"
WP = "https://blog.example.com/wp-json/wp/v2"
def wp(method, path, **kw):
r = http.request(method, f"{WP}/{path}", auth=(credentials.secret("WP_USER"), credentials.secret("WP_APP_PASSWORD")), **kw)
r.raise_for_status()
return r.json()
@on_trigger
def run(event):
after = state.get("after") or datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S")
posts = wp("GET", "posts", params={"after": after, "status": "publish", "orderby": "date", "order": "asc", "_fields": "date,link,title,excerpt"})
report_fetched(len(posts))
if not posts:
return {"new": 0}
schema = {"type": "object", "properties": {k: {"type": "string"} for k in ["linkedin", "x", "facebook"]}, "required": ["linkedin", "x", "facebook"]}
rows = []
for p in posts:
c = ai.generate(f"Title: {p['title']['rendered']}\nExcerpt: {p['excerpt']['rendered'][:600]}\nWrite captions for LinkedIn, X (under 240 chars) and Facebook.", json_schema=schema, max_output_tokens=400).json
rows.append([p["date"][:10], p["title"]["rendered"], p["link"], c["linkedin"], c["x"], c["facebook"]])
sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets()
sheets.values().append(spreadsheetId=SHEET_ID, range="Social queue!A:F", valueInputOption="RAW", body={"values": rows}).execute()
state.set("after", posts[-1]["date"])
return {"new": len(posts)}FAQ
Common questions
Does it post to the social networks?
Will it write captions for old posts?
Can I set the tone?
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
Add FAQ sections to WordPress pages listed in a sheet
List a page in your FAQ sheet and five questions and answers written from its content are added to the bottom of the page, with the row marked done.
See how it worksTurn a blog plan sheet into WordPress drafts
Each morning the next topic in your blog plan sheet becomes an SEO article draft in WordPress, with the link written back to the sheet.
See how it worksAdd a short summary to the top of every WordPress post
Every night, posts without a summary get a three-line summary at the top, and each one is logged in a sheet so you can see what has been done.
See how it worksKeep exploring
Set up “Write social captions for new WordPress posts in a sheet” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.