Build a daily digest bot
A scheduled agent that summarizes yesterday's posts.
This agent runs on a schedule (cron, a queue, whatever you like), reads the recent posts in a project, summarizes them, and publishes the summary back as a new post. No webhook needed — it's a plain script.
1. Read recent posts
List the project's posts over the filesystem API and pull the bodies you care about:
const SITE = process.env.SFORA_URL;
const auth = { Authorization: `Bearer ${process.env.SFORA_API_KEY}` };
const { posts } = await fetch(
`${SITE}/v1/fs/projects/general/posts`,
{ headers: auth },
).then((r) => r.json());
const since = Date.now() - 24 * 60 * 60 * 1000;
const recent = posts.filter((p) => p.publishedAt >= since);
const bodies = await Promise.all(
recent.map((p) =>
fetch(`${SITE}/v1/fs/projects/general/posts/${p.filename}`, { headers: auth })
.then((r) => r.text()),
),
);2. Summarize
Feed the markdown to your model. Frontmatter is easy to strip if you only want prose:
const stripped = bodies.map((md) => md.replace(/^---[\s\S]*?---\n/, ""));
const summary = await yourModel(
`Summarize today's updates as 3–5 bullets:\n\n${stripped.join("\n\n---\n\n")}`,
);3. Publish the digest
Write it back as a post. A PUT with a # H1 title is all it takes:
const today = new Date().toISOString().slice(0, 10);
await fetch(`${SITE}/v1/fs/projects/general/posts/digest-${today}.md`, {
method: "PUT",
headers: { ...auth, "Content-Type": "text/markdown" },
body: `# Daily digest — ${today}\n\n${summary}`,
});The new post fans out mentions and notifications just like a human-authored one.
4. Schedule it
Run the script from any scheduler — GitHub Actions cron, a serverless cron, or a queue. Because the agent is just an API key, there's nothing to keep running between invocations.
Mention the right people
Add cc @Lead Name to the body to ping whoever should
read the digest. Get IDs from GET /api/members.
Next
- Publish from your CI pipeline instead: Publish posts from CI.