A forkable Val Town app that imports settled Akahu transactions into a local SQLite review queue, then lets you manually import selected transactions into YNAB.
- Uses Akahu Personal App tokens, so each fork is for one person's own Akahu account.
- Uses a YNAB Personal Access Token.
- Stores state in the val-scoped Val Town SQLite database.
- Protects the dashboard with Val Town login plus
ADMIN_USERNAMES. - Syncs settled Akahu transactions only. Pending transactions are intentionally out of scope.
- Lets scheduled syncs fetch from Akahu into SQLite only. YNAB writes happen only from the web UI.
- Imports YNAB transactions as cleared, unapproved, uncategorized transactions with a stable
import_id.
Set these on your fork. For OAUTH_STATE_ENCRYPTION_KEY, use any long random string; it is not shared with Akahu or YNAB.
ADMIN_USERNAMES: comma-separated Val Town usernames allowed to open the dashboard.OAUTH_STATE_ENCRYPTION_KEY: random secret used by Val Town OAuth session state.AKAHU_USER_TOKEN: your Akahu User Access Token.AKAHU_APP_TOKEN: your Akahu App ID Token.YNAB_ACCESS_TOKEN: your YNAB Personal Access Token.
For this val, add them here:
https://www.val.town/x/jonpdw/ynab-import/environment-variables
Akahu:
- Sign in at https://my.akahu.nz/.
- Go to Developers.
- Create or open your Personal App.
- Copy the User Access Token and App ID Token into Val Town env vars.
YNAB:
- Sign in to https://app.ynab.com/.
- Go to Account Settings, then Developer Settings.
- Create a Personal Access Token.
- Copy it into
YNAB_ACCESS_TOKEN.
- Open the dashboard.
- Log in with Val Town.
- Click Refresh accounts.
- Select one YNAB plan.
- Map each Akahu account to a YNAB account or choose Ignore this account.
- Pick a backfill window. The default is 30 days.
- Run backfill.
- Review ready transactions and click Import selected.
The sync.ts interval runs daily at 0 18 * * * UTC. It only fetches settled Akahu transactions into SQLite. It does not write to YNAB.
After the first successful sync, future syncs use the last successful sync timestamp with a 7-day overlap so late changes can be seen again.
When someone remixes or forks the val, they should set their own env vars and keep their own val-scoped SQLite database. Do not share personal access tokens with other users.
Akahu Personal Apps are free but limited to your own Akahu account and do not support webhooks. YNAB Personal Access Tokens are intended for individual usage. A multi-user hosted version would need Akahu OAuth and YNAB OAuth instead.