Skip to content

Notify and gather bank transactions using Cloudflare Workers and Nordigen

License

Notifications You must be signed in to change notification settings

meltway-labs/bankman

Repository files navigation

$ bankman

A cron job running serverless on Cloudflare Workers.

This project uses Nordigen to connect to a bank account and searches for a specific transaction regex, alerting on Discord when this happens.

Pre-Requisites

1. Cloudflare Account

This project runs on Cloudflare Workers. You need a Cloudflare API token.

Use the Edit Cloudflare Workers template and add a new rule:

Account | D1 | Edit

2. Nordigen Account

Nordigen connects to your Open Banking-compatible bank account.

Sign up and follow the quickstart guide: https://nordigen.com/en/account_information_documenation/integration/quickstart_guide/

Save the account ID from step 5, you will need it later.

3. Discord Webhook

In order to send notifications, we currently only support Discord Webhooks.

Getting started

  1. Create a .env file in the root of the repository with the Cloudflare API Token and Account ID:

    CLOUDFLARE_API_TOKEN=<token>
    CLOUDFLARE_ACCOUNT_ID=<account_id>
    
  2. Create a .dev.vars file in the root of the repository with the following content:

    NORDIGEN_SECRET_ID=<secret>
    NORDIGEN_SECRET_KEY=<secret>
    NORDIGEN_ACCOUNT_ID=<account_id>
    DISCORD_URL=<discord-webhook-url>
    
  3. Create a .notify-patterns.json file with the transaction patterns to notify:

    [
        {
            "name": "salary",
            "pattern": "Weyland-Yutani"
        },
        {
            "name": "mortgage",
            "pattern": "Goliath National Bank"
        }
    ]

    Patterns are tested against the transaction description. If you need to update them later, edit the file above and run ./scripts/put-patterns.sh.

  4. Install the dependencies:

    npm i
  5. Run the bootstrap script to create all the resources and deploy:

    npm run bootstrap