Advanced : Event Hooks

Attaching listeners to these events can allow automation of operations/workflows

The extension emits custom events when certain operations have taken place. These events use the prefix zotero-roam:, and the details they contain can provide a basis for automation.

Events

metadata-added

Metadata has been added to an item's page

notes-added

Notes have been added to an item's page

tags-deleted

Tags have been deleted from Zotero

tags-modified

Tags have been modified in Zotero

update

A data update request has completed

update-collections

write

A write request to Zotero has completed

Schemas

zotero-roam:metadata-added

{
    args: {
        // The blocks received for insertion into the page.
        // Defined only if the default formatter or a JavaScript function was used.
        blocks?: [...],
        // The SmartBlock configuration received. 
        // Defined only if a SmartBlock was used.
        smartblock?: {
            param: "srcUid" | "srcName",
            paramValue: "some value"
        }
        uid: "some_uid",
    },
    error: null | Error, // The error thrown, if any
    page: {
        new: true | false, // Indicates if the Roam page was created during the operation
        title: "@citekey", // The title of the Roam page
        uid: "some_uid" // The UID of the Roam page
    },
    raw: {
        item: {...}, // The item's full Zotero metadata
        pdfs: [...], // The item's linked PDFs
        notes: [...] // The item's linked notes/annotations
    },
    success: null | true | false // The outcome of the operation
}

zotero-roam:notes-added

zotero-roam:tags-deleted

zotero-roam:tags-modified

zotero-roam:update

zotero-roam:write

Last updated

Was this helpful?