Push approved Notion calendar rows into Agorapulse drafts

By General Input

Approve a post in your Notion content calendar and it becomes a scheduled Agorapulse draft within half an hour, with no copy pasting.

Integrations

  • Notion
  • Agorapulse

Type

Deterministic Code

Categories

  • Marketing
  • Operations

Every 30 minutes, check my Notion content calendar for social posts my team has approved but has not yet handed off to Agorapulse, create an Agorapulse draft for each one, and immediately mark the Notion row as scheduled so the same post can never be pushed twice.

Read the calendar with Notion's Query a Data Source operation against my content calendar database. Filter for rows where the Status property equals Approved and the Agorapulse draft link property is still empty. Both conditions must hold. That empty draft link is the idempotency guard, so never act on a row that already has one.

For each matching row, read the caption text, the target social profiles and the scheduled publish date and time. Validate the row before doing anything else: if the caption is missing or the publish date is missing, skip that row entirely and leave its Status untouched at Approved so a human notices it sitting there and fixes it. Do not write anything back to a skipped row, and do not let one bad row fail the rest of the run.

To create the draft, first resolve the Agorapulse account structure: call Get Manager Organizations for the organization id, Get Organization Workspaces for the workspace id, and Get Workspace Profiles to list the connected social profiles. Agorapulse addresses profiles by opaque uid, so match the profile names stored on the Notion row to their profile uids. Resolve this once per run and reuse it across rows rather than repeating the lookup for every row.

Then call Agorapulse's Create Simple Draft operation with the row's caption as the post text, the matched profile uids as the targets, and the row's publish date and time as the scheduled send time. Create exactly one draft per Notion row.

Immediately after each individual draft is created successfully, update that specific Notion page with Update a Page: set Status to Scheduled and write the returned Agorapulse draft reference into the draft link property. Do this per row, right after its create call, never batched at the end of the run. If a draft is created but the writeback fails, surface that loudly, because that row would otherwise be picked up again on the next run and produce a duplicate draft.

Keep the run efficient and bounded. Agorapulse allows 500 requests per 30 minutes, which is the same window as the schedule, so process a sensible number of rows per run rather than an unbounded backlog in one pass.

Do not post to any social network directly, do not send notifications, and do not create records anywhere else. The Notion board is the single source of truth, and scheduled Agorapulse drafts are the only output, so final review still happens inside Agorapulse.

Related prompts

Explore more prompts
Screen chartered vessels for AIS gaps and sanctions red flagsCompare candidate store locations with drive time trade areasBrowse every competitor ad and build a Notion swipe fileAudience persona studio for brand and product marketersArtwork desk for the Notion posts still missing an imageShare of voice dashboard for your brand and competitorsInfluencer campaign roster board with AI creator briefsSmart home entity health cockpit for Home AssistantOpen model approval desk for your production AI stackBid board that watches every procurement portal for you