hackmd.mjs module wraps @hackmd/api to create and update meeting minutes documents on HackMD.
createHackMDClient(config, meetingConfig)
Creates an authenticated HackMD API client, pointed at either a team endpoint or the personal endpoint.
Parameters
Application configuration. Reads
config.hackmd.apiToken for authentication.Meeting configuration returned by
readMeetingConfig. Reads meetingConfig.properties.HACKMD_TEAM_NAME to determine the API base URL.Returns
HackMDAPI — a configured client instance.
- If
HACKMD_TEAM_NAMEis set in the meeting template: the client useshttps://api.hackmd.io/v1/teams/<team>as its base URL, so all requests operate in the context of that team’s workspace. - If
HACKMD_TEAM_NAMEis not set: the client useshttps://api.hackmd.io/v1(personal workspace).
getOrCreateMeetingNotesDocument(hackmdClient, title, config)
Returns an existing HackMD note with the given title, or creates a new empty one if none is found.
Parameters
HackMD API client returned by
createHackMDClient.The meeting title used to look up or name the document.
Application configuration. Reads
config.force to decide whether to skip the existing-note check.Returns
Promise<HackMDNote> — the existing or newly created note object.
Logic:
- If
forceisfalse: fetches the full note list from the HackMD account and returns the first note whosetitleexactly matches the given title. - If
forceistrueor no match is found: callscreateMeetingNotesDocumentwith an empty string for content. The caller is expected to populate the content in a subsequentupdateMeetingNotesDocumentcall.
createMeetingNotesDocument(hackmdClient, title, content)
Creates a new HackMD note with the given title and content.
Parameters
HackMD API client.
Document title.
Initial document content in markdown.
Returns
Promise<HackMDNote> — the created note object.
The note is created with the following default permissions from HACKMD_DEFAULT_PERMISSIONS:
| Permission | Value |
|---|---|
readPermission | "guest" |
writePermission | "signed_in" |
commentPermission | "signed_in_users" |
The HackMD API may return either
{ note: { ... } } or { ... } directly. The function normalises both shapes and always resolves with the note object itself.updateMeetingNotesDocument(hackmdClient, noteId, content)
Updates the content of an existing HackMD note by its ID.
Parameters
HackMD API client.
The ID of the HackMD note to update. Available as
note.id on the object returned by getOrCreateMeetingNotesDocument.The new document content in markdown.
Returns
Promise<HackMDNote> — the updated note object.
Like
createMeetingNotesDocument, this function normalises the API response to handle both { note: { ... } } and { ... } return shapes.