Granola (notes source)
@notewright/granola-notes-provider is the built-in notes source. It syncs
meeting notes and transcripts from Granola into D1. It
contributes a sync Durable Object (GranolaSyncAgent) that runs on a cron and on
demand.
Install and compose
Section titled “Install and compose”bun add @notewright/granola-notes-providerimport { defineApp } from "@notewright/core";import { granola } from "@notewright/granola-notes-provider";
const app = defineApp({ notes: granola, followUp: /* your sink */ });export default app;
export const { FollowUpAgent, SpeakerContextAgent } = app.durableObjects;export { GranolaSyncAgent } from "@notewright/granola-notes-provider";The provider exports the granola extension and the GranolaSyncAgent Durable
Object class. You must re-export GranolaSyncAgent from your entry so Cloudflare
can resolve it by class_name.
Configuration
Section titled “Configuration”The granola provider declares this configSchema:
| Key | Kind | Required | Purpose |
|---|---|---|---|
GRANOLA_API_KEY | secret | Yes | Granola API key, used to authenticate sync. |
GRANOLA_API_BASE_URL | var | No | Override the Granola API base URL. |
GRANOLA_PAGE_SIZE | var | No | Page size for listing updated notes. |
GRANOLA_REQUESTS_PER_SECOND | var | No | Client-side rate limit for outbound requests. |
Put GRANOLA_API_KEY in your deploy secrets (.env, applied with
--secrets-file), and the optional vars in the vars block of wrangler.jsonc
if you need to override the defaults.
Sync behavior
Section titled “Sync behavior”- Cron.
GranolaSyncAgentregisters the schedule0 0 * * 2-6(weekday evenings) on first start. Wake it after deploy withnotewright startso the schedule registers. (/healthis a core-owned Worker route; it does not reach the provider Durable Object, so it never registers the cron.) - On demand.
notewright sync(orPOST /sync) triggers a sync immediately. Because the Granola extension declares asyncbinding, the/syncroute forwards to theGranolaSyncAgentrather than running inline.
See Syncing & backfill for running and observing syncs.
Runtime contribution
Section titled “Runtime contribution”The Granola extension contributes the following through its runtime fragment, so
you do not hand-write them beyond the canonical wrangler.jsonc:
- Durable Object binding
GRANOLA_SYNC_AGENT→ classGranolaSyncAgent. - DO migration
granola-v1for theGranolaSyncAgentSQLite class.