SuperAPI AI Directory

publish-weekly

Office & productivity

View repository

Updated 10-15 18:00

About this skill

Publish Weekly (draft publish)

This skill is used to publish a locally generated weekly Markdown file to the Payload CMS weekly collection, and keep it as draft(status: draft)。

Prerequisites

  • Environment variable PAYLOAD_API_KEY: the API Key generated for a user from the Payload users collection.
  • Environment variable PAYLOAD_BASE_URL(recommended): the public address of the Payload/Next.js service (for example http://localhost:3000)。
  • Environment variable BARK_PUSH_URL(optional): the full Bark push endpoint (for example https://push.example.com/push/token/); if not configured, skip the notification.

Input

Obtained from the argument block of the /weekly command:

  • week_id: e.g. Y26W12(write to issueNumber)
  • title: write to title
  • filename: the weekly Markdown filename (read the file content from the working directory, write to content)
  • current_date: write to publishDate(ISO date string)

Optional:

  • summary: weekly description/summary (write to summary). If not provided, extract from content .
  • tags: tags (string array, e.g. ["模型", "工具"]). Write to the tags array field.
  • links: link list (object array, in the form [{ label, url }]), write to links。

Publish target

  • Collection: weekly
  • REST Endpoint:
    • Query:GET {BASE_URL}/api/weekly?where[issueNumber][equals]={week_id}&limit=1
    • Create:POST {BASE_URL}/api/weekly
    • Update:PATCH {BASE_URL}/api/weekly/{id}

Authentication method (HTTP Header)

Payload's API Key authentication header must be used:

Authorization: users API-Key {PAYLOAD_API_KEY}
Content-Type: application/json

Field mapping

When publishing/updating, write the following fields:

  • title(text, required): {title}
  • summary(textarea, required):
    • If provided, {summary}: use directly
    • Otherwise: extract 1-2 sentences from content (no more than 200 characters); if the beginning of the article already contains a "summary/lead", reuse it first
  • content(textarea, required): read {filename} 's full Markdown content
  • issueNumber(text, required, unique): {week_id}
  • status(select, required): always write draft
  • publishDate(date, required): {current_date}(recommended YYYY-MM-DD)

Optional fields (leave empty/omit if absent):

  • links(array): {links}, element structure is { label: string, url: string }
  • tags(array): convert {tags}(string array) to [{ value: string }]

Request Body example

{
  "title": "Agili 的 AIGC 周刊(Y26W12)",
  "issueNumber": "Y26W12",
  "publishDate": "2026-03-25",
  "status": "draft",
  "summary": "本期聚焦推理模型的工程化落地,以及一批值得试用的生产力工具。",
  "content": "# ...完整 Markdown...",
  "links": [{ "label": "在线阅读", "url": "https://aigc-weekly.agi.li" }],
  "tags": [{ "value": "模型" }, { "value": "工具" }]
}

Behavior constraints

  1. Idempotent: query first by issueNumber == week_id :
    • If it already exists: update with PATCH (overwrite title/summary/content/publishDate/status/links/tags)。
    • If it does not exist: create with POST .
  2. Keep as draft: whether creating or updating, must write status: "draft"。
  3. Artifact persistence: save the response JSON of a successful create/update as published/{week_id}.json, for later recovery and auditing.
  4. Diagnosable on failure: if the request fails, output: HTTP status code, response body (if any), request URL (do not leak PAYLOAD_API_KEY)。
  5. Draft notification: only after Payload POST/PATCH succeeds and the response has been saved to published/{week_id}.json , execute:
    • If not configured, BARK_PUSH_URL, skip directly.
    • POST JSON to BARK_PUSH_URL , 5-second timeout:title is {week_id}|周刊草稿已生成,body is {title},url is {PAYLOAD_BASE_URL 去掉末尾斜杠}/admin/collections/weekly/{CMS 响应中的文档 id}。
    • The request body must be constructed using a JSON serialization tool; JSON must not be generated by string concatenation; at the same time, both HTTP success and the response JSON's code === 200。
    • On notification failure, output only diagnostics such as timeout, HTTP status, or response code; do not print BARK_PUSH_URL or any credentials; a draft that has already been successfully written must not be judged as failed, and audit artifacts must not be deleted.