Skip to content

Build

Recipes

Whole tasks from start to finish. Each one uses the smallest key that does the job and leaves the final say on what goes live to a person.

A weekly report for every page

Views this week against last week, and the most clicked link, for each page you can reach. Use a Read only key: the script cannot change anything even if it has a bug.

const api = (path, init = {}) =>
  fetch(`https://buzzkit.app/api/agent${path}`, {
    ...init,
    headers: { Authorization: `Bearer ${process.env.BUZZKIT_API_KEY}`, "Content-Type": "application/json", ...init.headers },
  }).then(async (response) => {
    const body = await response.json();
    if (!response.ok) throw Object.assign(new Error(body.error.message), body.error);
    return body;
  });

const { data: pages } = await api("/profiles");
for (const page of pages) {
  const summary = await api(`/profiles/${page.id}/analytics/summary?days=7`);
  const top = await api(`/profiles/${page.id}/analytics/top-links?days=7`);
  const change = summary.totals.views - summary.previous.views;
  console.log(`${page.username}: ${summary.totals.views} views (${change >= 0 ? "+" : ""}${change}), top link: ${top.links[0]?.title ?? "none"}`);
}

Numbers are approximate on purpose: visitors are counted without cookies and bots are left out, as in the dashboard.

Build a page from a list

Add several links to the draft, show the owner what changed, then publish. A fixed Idempotency-Key per link means running the script twice in 24 hours does not add them twice.

const api = (path, init = {}) =>
  fetch(`https://buzzkit.app/api/agent${path}`, {
    ...init,
    headers: { Authorization: `Bearer ${process.env.BUZZKIT_API_KEY}`, "Content-Type": "application/json", ...init.headers },
  }).then(async (response) => {
    const body = await response.json();
    if (!response.ok) throw Object.assign(new Error(body.error.message), body.error);
    return body;
  });

const links = [
  { title: "Shop", url: "https://shop.example" },
  { title: "Podcast", url: "https://podcast.example" },
  { title: "Newsletter", url: "https://letter.example" },
];

const page = "jane";
for (const [index, item] of links.entries()) {
  await api(`/profiles/${page}/links`, {
    method: "POST",
    // Same key on a rerun: the script can be run twice without doubling the links.
    headers: { "Idempotency-Key": `import-2026-11-${index}` },
    body: JSON.stringify({ type: "link", ...item }),
  });
}

const status = await api(`/profiles/${page}/publish`);
const changes = await api(`/profiles/${page}/publish/changes`);
console.log(changes); // show this to the page owner, then:
await api(`/profiles/${page}/publish`, { method: "POST", body: JSON.stringify({ expectedRevision: status.revision }) });

One change across client pages

For agencies: make a key limited to the client's workspace, change every page in it, and ask the client to approve instead of publishing yourself. The key cannot reach your other clients even by mistake.

const api = (path, init = {}) =>
  fetch(`https://buzzkit.app/api/agent${path}`, {
    ...init,
    headers: { Authorization: `Bearer ${process.env.BUZZKIT_API_KEY}`, "Content-Type": "application/json", ...init.headers },
  }).then(async (response) => {
    const body = await response.json();
    if (!response.ok) throw Object.assign(new Error(body.error.message), body.error);
    return body;
  });

const workspaceId = "<client workspace id>";
const { data: pages } = await api(`/profiles?workspaceId=${workspaceId}`);

for (const page of pages) {
  await api(`/profiles/${page.id}`, {
    method: "PATCH",
    body: JSON.stringify({ announcement: "Closed for the holidays until 2 January" }),
  });
  // Leave publishing to the client: ask for a review instead.
  await api(`/profiles/${page.id}/reviews`, {
    method: "POST",
    body: JSON.stringify({ message: "Holiday notice for your page. Approve to publish." }),
  });
}

Check that the colors are readable

check_design_colors says whether the text, title and buttons of the draft are easy to read, in plain words. match_design_colors fixes them in the draft, and suggest_design_palettes offers Light, Dark, Vivid and Soft sets around a brand color. They use the same rules as Match colors in the editor, and update_design reports readability after every change without ever blocking it.

const api = (path, init = {}) =>
  fetch(`https://buzzkit.app/api/agent${path}`, {
    ...init,
    headers: { Authorization: `Bearer ${process.env.BUZZKIT_API_KEY}`, "Content-Type": "application/json", ...init.headers },
  }).then(async (response) => {
    const body = await response.json();
    if (!response.ok) throw Object.assign(new Error(body.error.message), body.error);
    return body;
  });

const page = "jane";
const check = await api(`/profiles/${page}/design/colors/check`);
if (!check.ok) {
  console.log(check.issues.map((issue) => issue.message)); // plain words, safe to show
  const result = await api(`/profiles/${page}/design/colors/match`, { method: "POST" });
  console.log(result.changed, result.remaining); // draft only: nothing is live until you publish
}

// Or start from a brand color and apply the palette you like through update_design:
const { palettes } = await api(`/profiles/${page}/design/colors/palettes?brandColor=%233366ff`);
await api(`/profiles/${page}/design`, { method: "PATCH", body: JSON.stringify(palettes[0].colors) });

Nothing here publishes: the changes wait in the draft like any other edit, so you can show the owner a preview first. To go back, send the old values in changed to update_design, or use revert_item with type theme to return to the live design.

Retry the right errors

Retry only when waiting can help: rate_limited, unavailable and internal_error. Everything else needs a different request.

async function withRetry(call, attempts = 4) {
  for (let attempt = 1; ; attempt++) {
    try {
      return await call();
    } catch (error) {
      const retryable = ["rate_limited", "unavailable", "internal_error"].includes(error.code);
      if (!retryable || attempt === attempts) throw error;
      // Retry-After is in the headers; a growing pause is a safe fallback.
      await new Promise((resolve) => setTimeout(resolve, 1000 * 2 ** attempt));
    }
  }
}

Asking an assistant

Once BuzzKit is connected over MCP, these work as plain requests. The assistant picks the tools and asks you before it publishes or deletes.

Things to ask
Which of my links got the most clicks this month, and which got none?

Add a link to my new video at the top of my page and show me the changes.

Make my page's buttons rounded and dark green, then publish once I've seen the preview.

Is my page easy to read? Fix any colors that are not.

For every page in the Acme workspace, set the announcement to "Closed until 2 January" and ask for review.

What questions have visitors asked this week? Draft short answers for me to check.

AI agents? Read this page as Markdown, or the API as OpenAPI.