atom, a publishing and audience automation platform
A client’s publishing and audience work outgrew a hosted automation tool. Lubili designed and delivered atom: one custom platform that publishes from Google Drive to Instagram, YouTube, LinkedIn and X, turns Instagram comments into private conversations and delivered resources, and can be operated by an AI assistant over MCP. It is live in production, serving an active user base.
- Type
- Custom publishing and Instagram automation platform with an MCP server
- Role
- Architecture, engineering and delivery of the full system for a client
- Stack
- Cloudflare Workers, D1, Queues and KV, TypeScript, Hono, Zod, Next.js (static export), Tailwind CSS, WebAuthn passkeys, OAuth 2.1 and MCP, Google Drive API, YouTube Data API, Instagram Graph API, messaging and webhooks, Vitest
Context
The problem: a hosted automation tool was no longer enough
The client publishes short video to Instagram and YouTube from files kept in Google Drive. The workflow ran on a hosted automation tool, and its plan no longer fit the volume. LinkedIn and X were added later.
The same audience also asks for things in the comments: a guide, a link, a file. Answering each person by hand is slow, easy to miss and impossible to keep up at volume, and a hosted tool that only sends a reply does not follow the platform’s messaging rules, avoid duplicates or keep a person in control.
Publishing to two platforms is more than moving a file. Each has its own upload rules, quotas, scheduling model and ways to fail halfway. The client needed posts to go out on time without a computer switched on, comments answered once and on time, a person in control of what goes live and what is sent, and a clear record of what happened.
Why a custom platform
A general automation tool is built to connect steps. Scheduling, the state of each post, platform quotas and recovery after a half-finished publish are left to the workflow.
Owning that logic meant limits could come from the platforms’ own rules instead of a plan tier, and controls the client needed, such as an approval step and an AI assistant interface, could be built in.
One system owns both jobs because publishing and comment-to-DM depend on the same Instagram connection, the same limits, the same approval and the same audit trail.
Lubili’s role
Lubili designed, engineered and delivered atom for the client: the architecture, the scheduler and publishing engine, the Google Drive, YouTube, Instagram, LinkedIn and X integrations, the comment-to-DM engine and its messaging rules, the dashboard, the MCP server, security, and the automated test suite.
The system runs in production on serverless infrastructure and is operated through a dashboard and, optionally, an AI assistant.
What we built
Inside atom: publishing to four channels and comment-to-DM on Instagram
Google Drive media library
Connects through OAuth and syncs from Drive’s change feed, including folders backed up with Drive for desktop. New files arrive as “in review”, duplicates are linked, and files are checked for completeness before they can be approved. Drive access is read-only: atom never changes, moves or deletes a file.
Drafts and composer
Instagram Reels and Stories, YouTube videos and Shorts, LinkedIn Company Page posts and X posts, with captions, titles, tags, privacy and thumbnails where a platform has them. Fields are validated against each platform’s rules before anything is submitted, and a draft can be saved, scheduled or published now.
A cloud scheduler
A one-minute cron claims due jobs, hands them to a queue and sweeps for overdue or stuck work, so posts go out with every device switched off. A global pause switch and a dry-run mode stop or rehearse everything without losing a job.
YouTube publishing
Resumable uploads streamed from Drive in windows, with the confirmed offset saved so an interrupted upload resumes instead of restarting. Privacy is always set explicitly, scheduling uses YouTube’s own publish time, and upload, processing and visibility are tracked separately.
Instagram publishing
Creates a Reel or Story container, waits for Meta to finish processing, then publishes exactly once. If the outcome is ever unclear, atom asks Meta what happened instead of sending the request again. The video reaches Meta through a short-lived, single-use link or a resumable upload.
LinkedIn and X publishing
Posts to a LinkedIn Company Page (text up to 3,000 characters, with the video) and to X (text only, one video, or up to four images) are published by atom. They can be scheduled or published now, use the same approval step as the other platforms, and are checked against each platform’s limits before they are submitted.
Comment-to-DM automations
Someone comments a keyword on a Reel, and atom replies in public, sends a private message and delivers a Google Drive file. Workflows are unlimited, each is tied to one or more Reels, with trigger keywords, several public-reply variations, the message texts and the file link. They can be draft, active, paused or archived, cloned and restored, and deleting one keeps its history.
Follow gate
A workflow can require the person to follow the account first, using Instagram’s own follow status. It is on by default for new workflows. An unknown answer is never treated as yes or no, so nobody is wrongly told to follow, and nobody gets the file by mistake.
Delivery limits
One private reply per comment and one file per conversation. A per-person cap (3 by default) stops anyone being sent the same file again and again, and a person who reaches it gets a short message instead. Sending is paced, with back-off when the platform asks for it.
Messaging rules built in
The private-reply window of 7 days and the 24-hour window after a person responds are checked in one place before every send, and are never stretched. A duplicate webhook cannot produce a second reply or a second file.
Testing and analytics
A dry run exercises a workflow without sending anything. Statistics are shown per workflow and date range, and “submitted” is kept apart from “delivered”. A setup screen lists what is connected and permitted, and claims nothing it cannot verify.
Quota awareness
YouTube’s upload allowance is counted and checked, and Instagram’s publishing limit is read from Meta, not hard-coded. A job that would exceed a limit is deferred and resumes by itself when capacity returns, so it is never lost or failed.
Dashboard
Connections for each account, a schedule with a live execution log for every job, what is currently live on each platform, usage and quotas, and system health. It works on a phone.
MCP server
A remote MCP server with OAuth 2.1 and four scopes (read, draft, schedule, publish) exposes 19 tools for publishing and a further 20 for automations, so an AI assistant can find files, prepare drafts, schedule posts, check results, and create, test, activate or pause a comment-to-DM workflow. It calls the same services as the dashboard, so both behave identically.
Security and access
Passkeys, owner-only Google sign-in and single-use recovery codes. Platform tokens are encrypted at rest with AES-256-GCM, every API route denies by default, and security-relevant actions go to a separate audit log.
Engineering
Key decisions
The database is the truth, the queue only delivers.
Every state change and its dispatch request are written in one transaction, and the queue is treated as at-least-once. A duplicate delivery finds a newer version or a held lease and does nothing, so a retry cannot publish twice.
Reconcile, never repeat.
After any request that may have succeeded, such as a timeout during publish, atom checks what the platform recorded before it acts again. A post that cannot be confirmed goes to “needs attention” for a person instead of being sent a second time.
Stream, never store.
Video moves from Drive to the platform in bounded windows and is never buffered whole or copied. That keeps memory flat and avoids holding a second copy of the client’s media.
Defer, do not fail.
A used-up quota, a revoked token or a paused switch moves a job to a waiting state with a reason and a resume time. Nothing is marked failed for a cause that will clear.
One reply per comment, even when the platform sends it twice.
Incoming events are recorded once, and each step of a conversation is saved as durable work that can be retried safely. A repeated webhook finds work already done and does nothing.
Messaging rules live in one place.
A single policy decides whether a message may be sent, and it is checked again right before every send. Retries and background runs never extend a window.
Overlap is refused, not guessed.
A comment can start at most one workflow. If two workflows would claim the same comment on the same Reel, activation is refused and shows the exact conflict.
The assistant prepares, the owner decides.
Publishing straight from an assistant needs the publish scope, an owner switch that is off by default, and a single-use confirmation tied to the exact content previewed. Activating or deleting an automation also needs explicit confirmation. There are no admin tools over MCP, and text from Drive is returned as data, never as instructions.
One module per platform.
Each platform sits behind its own connector with its own state, quota entry and error mapping, so a problem with one cannot stop the others. LinkedIn and X were added this way, as new connectors. Adding another platform is a new module, not a rewrite.
Built for tight limits.
The serverless platform’s per-request CPU and outbound-call limits shaped the design: work is bounded, streamed and resumable, and heavy steps run as queued jobs instead of inside a request.
Custom versus off the shelf
Where a custom platform goes further than a no-code tool
Hosted automation tools such as Zapier are a good fit for many workflows. atom exists because this one needed things a tool of that kind is not built to provide.
Scheduling that is part of the system
Jobs have explicit states, overdue work is found and recovered, and publishing can be paused or rehearsed with a switch.
Large files, streamed
Video goes from Drive to the platform in resumable windows, so the limits are those of YouTube and Instagram themselves.
Platform rules built in
Reel format checks before upload, YouTube privacy always explicit, quotas read from the platforms, and unclear results reconciled instead of repeated.
Conversation rules that protect the account
Reply windows, one reply per comment, per-person limits and a follow check are enforced before every message, instead of being left to each workflow.
Custom control
An approval step, a live execution log and an MCP interface for AI assistants, designed around how the client works.
Extensible by design
Google Drive, YouTube, Instagram, LinkedIn and X today. Because each platform is a connector behind a common interface, any tool or platform that offers a developer API can be added, subject to its terms and API access.
Results
Results of atom
- Live in production and serving an active user base.
- Posts go out on schedule with no computer switched on.
- Every action is recorded, with a live log for each job and a separate audit trail.
- Duplicate and missed publishes are guarded against: steps are idempotent and unclear results are reconciled.
- An AI assistant can handle the routine work while the owner keeps final control.
- Platform limits, not a plan tier, decide what can be published.
- Comments are answered once, even when the platform sends the same event twice.
- A person who reaches the delivery limit gets a short message instead of the file, so no one is flooded.
- Every automation action is logged and can be reviewed, and a workflow can be tested without sending anything.
Architecture
The full system
For engineering readers. Everything in the drawing is described in the text above.
One Worker and one source of truth. The dashboard and the AI assistant call the same services, and each platform sits behind its own connector. Four more drawings follow: a post’s life, the streaming path to YouTube and Instagram, a comment becoming a delivered file, and the assistant workflow.
The life of a post
Streaming from Drive to YouTube and Instagram
From a comment to a delivered file
How an AI assistant works with atom
Stack
Technology
- Cloudflare Workers, D1, Queues and KV
- TypeScript
- Hono
- Zod
- Next.js (static export)
- Tailwind CSS
- WebAuthn passkeys
- OAuth 2.1 and MCP
- Google Drive API
- YouTube Data API
- Instagram Graph API, messaging and webhooks
- Vitest
For your business
Similar problems Lubili can solve
Any workflow that has outgrown a hosted automation tool: scheduled publishing, lead magnets or guides delivered from comments, questions answered from a post, giveaway entries, document or media pipelines, multi-platform integrations, and processes that need approval, quotas, recovery and an audit trail. Lubili also builds the AI assistant interface (MCP) on top of such systems.
Client work. Client details are kept confidential.
Want comments turned into conversations, and content published on time?
Book a free consultation, and we will look at what you need, what a custom platform would involve, and whether it is the right choice.
Free. No obligation. You get a one-page written summary.