Skip to content

Readwise Reader and MyMind

Hotaru sends items on to Readwise Reader and MyMind by itself (SI-562). This replaces the last two n8n flows: Raindrop Inbox → Readwise and Raindrop Inbox → mymind. Code: services/forwarding.ts, the queue in services/forward-queue.ts, and the API calls in integrations/readwise-api.ts and integrations/mymind-api.ts.

An item gets to either service in three ways:

  • By the routing, after you save it to Raindrop.io or star it, if it’s a kind of item the routing sends. This is what the n8n chain did.
  • By a rule, whatever the routing says (rules.md).
  • By hand, from the buttons in the reader.

Connecting

Each user connects their own accounts, under Settings → Readwise Reader (/settings/readwise) and Settings → MyMind (/settings/mymind).

  • Readwise Reader: the access token from readwise.io/access_token. Hotaru checks it with Readwise (GET /api/v2/auth/, which answers 204) before it keeps it.
  • MyMind: an access key from access.mymind.com/extensions, with full access: its ID and its secret. MyMind shows the secret only once. Hotaru checks the key by listing your spaces (GET /spaces). The settings show the key’s ID, never the secret.

Both are stored encrypted in integrations.credentials, as Raindrop’s token is (raindrop.md): AES-256-GCM under a key derived from BETTER_AUTH_SECRET. Connecting again replaces the credentials, keeps the settings, and sends the failed items again. Disconnect forgets them. What’s in Readwise or MyMind stays, sent items keep their mark, and items still queued are marked failed.

Routing

What each service gets by itself is the routing on its settings page. A new connection starts with the n8n chain’s:

Readwise Reader MyMind
Send on its own when You save an item to Raindrop.io You save an item to Raindrop.io
Which items Long reads and videos Everything: long reads, videos and quick reads

Both can be changed:

  • Send on its own when: you save an item to Raindrop.io (by the bookmark button or by a rule), you star an item (by the star or by a rule), both, or neither. Neither leaves rules and the buttons.
  • Which items: long reads, videos and quick reads, each on or off.
  • A long read takes at least n minutes, 5 by default, from 1 to 120.
  • Readwise: where new documents go: Inbox (the default), Later, Archive or Feed.
  • MyMind: the space items go into, or none.
  • Tags on every item. Rules can add their own.

An item goes to each service at most once by the routing. Saving it to Raindrop again, or starring it again, sends nothing more. Turning a trigger on doesn’t send the items you saved or starred before.

Long read, video or quick read

Hotaru judges each item by its type and the length of its text:

Format When
Video A YouTube item: a video, Short or live stream
Long read Its reading time, as its card shows it (230 words a minute, rounded), is at least the minutes set. 5 minutes means 1,035 words and more
Quick read Everything else

The length is the text the extract stage found: the article behind a teaser, or the feed’s own text. It’s the same reading time as on the card, so what you see is what the routing sends. It costs no AI call.

The issue asked for the AI to decide. A model would read the same two facts, type and length, and pay for it on every saved item, so Hotaru doesn’t call one. If length alone ever sorts badly (long link lists, say), a model’s verdict can be added to this one function, itemFormat() in forward-queue.ts.

An item you save or star before its text is extracted waits for it. The scheduler looks every 5 minutes, for at most an hour after the item arrived. After that, the feed’s own text decides: the extract stage might be turned off or failing. Videos are known at once.

What the services get

Readwise Reader (POST /api/v3/save/):

Field From
url The item’s URL. Reader fetches the page itself
title, author The item’s
summary The AI summary, else the excerpt
image_url The item’s original image
published_date When it was published, unless the source gives no date
category video for videos, otherwise article
location The rule’s, else the connection’s
tags The connection’s, then the rule’s
saved_using Hotaru

MyMind (POST /objects):

Field From
url The item’s URL. MyMind fetches and files it
title The item’s
tags The connection’s, then the rule’s, as { name }
spaces The rule’s space, else the connection’s, if any

Every MyMind request carries a fresh JWT: HS256, the key’s ID as kid, the request’s method and path as claims, valid for five minutes, signed with the secret’s base64-decoded bytes (mymindToken()), and a User-Agent. Each save costs MyMind credits (10 to 250, by its API’s terms).

Both services answer 200 with the document or object they already have when a URL comes again, so a second send never makes a duplicate.

Status and retries

Every send is a row in item_saves, like a Raindrop save, with kind readwise or mymind. Stream entries carry the status as readwiseStatus and mymindStatus. The reader has one button per connected service:

Status Button
None Outlined book (Readwise) or brain (MyMind)
saving Pulsing: queued, or on its way. A click sends it now
saved In firefly green. A click sends it again
failed Red. The label says why; a click tries again

A click sends the item now, whatever the routing says. The settings page lists the latest 20 sends: the item, its status, why it went (by hand, by a rule, after the star or the Raindrop save), its format, and for a failed one the error and Try again.

The scheduler sends what’s queued on every tick, one item after another, at most 20 a tick, right after the Raindrop saves. A Raindrop save that went through earlier in the round queues its item, and the same round sends it on. Failures for a passing reason (no connection, a timeout, a rate limit, an error on the service’s side) are tried again after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours, six tries in all, as Raindrop saves are. A rate limit waits at least as long as the service asks: Readwise’s Retry-After, or for MyMind the longest window whose credits ran out in its RateLimit header. A send cut off by a restart (still saving five minutes later) is picked up the same way.

Refusals (HTTP 400 or 422) aren’t tried again. A rejected token or key (HTTP 401 or 403) shows on the settings page until you connect again, which tries the failed items again. With SCHEDULER_ENABLED=false, queued items wait and nothing is retried on its own.

Readwise allows 50 saves a minute per token. MyMind meters credits: a burst window of 5 minutes and a sustained window of 30 days, by plan.

Switching n8n off

With both connected and the default routing, flows 2 (→ Readwise) and 3 (→ mymind) can be turned off: what you save to Raindrop from Hotaru goes on by itself. Flow 1 (star → Raindrop) is already gone (raindrop.md).

One difference remains: the n8n flows also forwarded bookmarks saved to Raindrop outside Hotaru, from the browser or the phone. Hotaru only forwards its own items. Keep the flows for those, or save such pages through Hotaru.

API

All endpoints need a login or an API token. Changes need a write token.

Method and path What it does
GET /api/v1/integrations/readwise The connection: connected, sendOn, formats, longReadMinutes, tags, location, lastError, connectedAt. Never the token
PUT /api/v1/integrations/readwise Connect with { "token": "…" }. 422 when Readwise rejects it
PATCH /api/v1/integrations/readwise Change any of sendOn, formats, longReadMinutes, tags, location
DELETE /api/v1/integrations/readwise Disconnect (204)
GET /api/v1/integrations/mymind The connection, with account (the key’s ID) and spaceId instead of location
PUT /api/v1/integrations/mymind Connect with { "keyId": "…", "secret": "…" }. 422 when MyMind rejects it
PATCH /api/v1/integrations/mymind Change any of sendOn, formats, longReadMinutes, tags, spaceId (null: none)
DELETE /api/v1/integrations/mymind Disconnect (204)
GET /api/v1/integrations/mymind/spaces { spaces: [{ id, name }] }. 409 when not connected
GET /api/v1/items/:id/readwise, …/mymind { "save": … } or null: status, target, tags, trigger, format, remoteId, error, attempts, nextAttemptAt, savedAt
POST /api/v1/items/:id/readwise Send now, with optional tags and location. 502 with message and save when Readwise fails, 409 when not connected, 422 when the item has no link
POST /api/v1/items/:id/mymind Send now, with optional tags and spaceId

sendOn is a list of star and raindrop; formats of long, video and quick.

The SDK: readwise(), connectReadwise(), updateReadwise(), disconnectReadwise(), readwiseSave(), sendToReadwise(), and mymind(), connectMymind(), updateMymind(), disconnectMymind(), mymindSpaces(), mymindSave(), sendToMymind().

const hotaru = createClient({ baseUrl: 'https://hotaru.example.com', token });
await hotaru.updateReadwise({ sendOn: ['raindrop', 'star'], formats: ['long', 'video'] });
await hotaru.sendToMymind(itemId, { tags: ['svelte'] });

Storage

item_saves got three columns (migration 0031_forwarding): target (the Readwise location or MyMind space; null for the connection’s default), trigger (null by hand, rule, star, raindrop) and format (long, video, quick; null while the routing waits for the text). The routing and defaults live in integrations.settings.

Tests

The tests never talk to the real services. Unit tests (forwarding.spec.ts) run local fakes that check the Readwise token and verify each MyMind JWT’s signature, key, method, path and expiry. The Playwright test (forwarding.e2e.ts) starts one fake for both on port 4197, and the e2e server points at it with READWISE_API_URL and MYMIND_API_URL. Leave those unset in production.