Your marketing team wants to schedule a product announcement for Tuesday at 8 AM EST but your headless CMS has no built-in scheduler. ContentGrid does not include scheduling as a UI feature, but you can build a reliable scheduled publishing system in about two hours using a publish date field and a Vercel Cron job.
Adding a Publish Date Field
Add a publishAt DateTime field to any content type that needs scheduling. Editors set this field when they want the entry to go live. Also add a status field with values draft and published. The scheduler will flip status to published when the current time passes the publishAt timestamp.
- Make publishAt optional — entries without a date publish immediately when status is set manually.
- Store the timestamp in UTC in ContentGrid. Convert to local time only in the UI.
- Add a publishedAt field (separate from publishAt) to record when the entry actually went live.
Writing the Publisher API Route
Create an API route in your Next.js app at /api/publish-scheduled. This route will be called by a cron job:
- Authenticate the request with a secret header to prevent public access.
- Query ContentGrid for all entries where status = draft and publishAt <= now().
- For each matching entry, update the status to published and set publishedAt to the current timestamp.
- Trigger revalidation for the affected pages so the content goes live on the site immediately.
Use the ContentGrid Management API for the status update — it requires an API key with write access, which you store as a server-side environment variable.
Setting Up Vercel Cron
Vercel Cron runs your API route on a schedule. Add a vercel.json cron configuration:
- Set the path to /api/publish-scheduled.
- Set the schedule to */5 * * * * for every five minutes — enough granularity for most teams.
- Add the cron secret to your Vercel environment variables.
- Deploy to Vercel and verify the cron job appears in the Vercel dashboard under Settings → Cron Jobs.
Testing the Scheduler
Before relying on the cron schedule, test the route manually:
- Create a test entry with a publishAt time two minutes in the past.
- Call the API route directly with the secret header.
- Check that the entry status changed to published in ContentGrid.
- Check that the page on your site shows the updated content.
The cron approach is simple, transparent, and free within Vercel's hobby and pro plan limits. It handles most scheduling needs without a third-party service. If you need sub-minute precision, switch to a Vercel Edge Function with a shorter poll interval or use a dedicated job queue like Inngest or Trigger.dev.
Ready to start tracking your competitors?
ContentGrid automatically monitors competitor websites, emails, and social media — and delivers structured intelligence straight to your inbox.