首页/财务与会计/norwegian-accounting-automation
N

norwegian-accounting-automation

by @ahdragev
3.5(0)

这是一个AI代理技能,旨在自动化挪威小型企业的会计流程。它通过集成Fiken、Folio API和Google Workspace CLI,实现发票处理、费用预订、银行交易对账、附件上传及增值税处理。适用于需要简化挪威会计、提高效率、减少人工操作、处理Fiken/Folio事务或整合Gmail发票搜索的企业。

Norwegian AccountingFikenFolioBookkeepingAutomationGitHub
安装方式
git clone https://github.com/ahdrage/norwegian-accounting-automation.git
compare_arrows

Before / After 效果对比

1
使用前

挪威小型企业会计工作需手动处理发票、录入费用、核对银行交易和增值税申报,耗时且易出错,需频繁切换Fiken、Folio和Gmail等平台。

使用后

借助AI代理,自动处理发票、预订费用、智能对账和增值税管理,显著减少人工操作,提高准确性,使会计流程更高效、无缝。

description SKILL.md


name: norwegian-accounting-automation description: Automate Norwegian small business accounting using the Fiken API, Folio API, and Google Workspace CLI (gws). Covers processing invoices, matching bank transactions, booking expenses/sales, uploading attachments, and reconciling card charges. Use when the user wants to automate bookkeeping, process invoices, book expenses in Fiken, handle Folio card transactions, reconcile Vipps settlements, or integrate Gmail invoice search with accounting software. Also use when the user mentions Fiken, Folio, Norwegian accounting, regnskap, or MVA/VAT handling for Norwegian businesses.

Norwegian Accounting Automation

Automate bookkeeping for Norwegian small businesses (ENK/AS) using:

  • Fiken — accounting software with REST API
  • Folio — business card/banking with REST API
  • Google Workspace CLI (gws) — search Gmail for invoices and download attachments

Prerequisites

1. Install Google Workspace CLI

npm install -g @googleworkspace/cli
gws auth setup
gws auth login -s gmail

See gws-setup.md for detailed setup instructions.

2. Fiken API Key

  1. Log in to fiken.no
  2. Go to Innstillinger → API and create an API token
  3. Store as FIKEN_API_KEY in .env

Base URL: https://api.fiken.no/api/v2 Auth: Authorization: Bearer {FIKEN_API_KEY} Docs: https://api.fiken.no/api/v2/docs

3. Folio API Key

  1. Log in to the Folio app
  2. Go to Settings → Integrations → API and create a key
  3. Store as FOLIO_API_KEY in .env

Base URL: https://api.folio.no/v2 Auth: Authorization: Bearer {FOLIO_API_KEY} Docs: https://dev.api.folio.no/v2/api

4. Find your Fiken company slug

curl -s "https://api.fiken.no/api/v2/companies" \
  -H "Authorization: Bearer $FIKEN_API_KEY" | jq '.[].slug'

Use this slug in all Fiken API paths: /companies/{slug}/...

Core Concepts

Norwegian VAT Types in Fiken

vatTypeWhen to usenetPricevat
HIGHNorwegian 25% VATgross / 1.25gross - net
HIGH_FOREIGN_SERVICE_DEDUCTIBLEForeign SaaS/services (USD/EUR/GBP). Triggers reverse charge.Full NOK amount0
NONEForeign physical goods (import VAT via customs)Full NOK amount0

All amounts in Fiken are in øre (1 NOK = 100). E.g. 438.00 NOK = 43800.

VAT types are account-specific. HIGH_FOREIGN_SERVICE_DEDUCTIBLE is NOT valid on all accounts. Check error messages for valid codes per account.

Common Fiken Expense Accounts

AccountDescriptionTypical use
6553ProgramvareSaaS subscriptions
7321ReklamekostnadMarketing/advertising
6100Frakt/transportShipping costs
6800KontorrekvisitaOffice/packaging supplies
1200Inventar/eiendelerPhysical equipment
4300VarekjøpGoods for resale
3000SalgsinntektRevenue

Payment Accounts

CodeDescription
2062Privatutlegg (personal card reimbursement)
1920:NNNNNBusiness bank card (Folio-kort, DNB, etc.)
1960:NNNNNPayment service accounts (Vipps, Stripe)

Find your payment account codes:

curl -s "https://api.fiken.no/api/v2/companies/{slug}/bankAccounts" \
  -H "Authorization: Bearer $FIKEN_API_KEY" | jq '.[] | {name, accountCode}'

Workflows

A. Book an expense (purchase) in Fiken

curl -X POST "https://api.fiken.no/api/v2/companies/{slug}/purchases" \
  -H "Authorization: Bearer $FIKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2025-01-02",
    "kind": "cash_purchase",
    "currency": "NOK",
    "paid": true,
    "lines": [{
      "description": "Service name (2025-01-02)",
      "account": "6553",
      "netPrice": 36970,
      "vat": 0,
      "vatType": "HIGH_FOREIGN_SERVICE_DEDUCTIBLE"
    }],
    "paymentAccount": "1920:10003",
    "paymentDate": "2025-01-02"
  }'

For Norwegian vendors with 25% VAT:

{
  "lines": [{
    "account": "6553",
    "netPrice": 15920,
    "vat": 3980,
    "vatType": "HIGH"
  }]
}

B. Attach a PDF to a Fiken purchase

curl -X POST "https://api.fiken.no/api/v2/companies/{slug}/purchases/{purchaseId}/attachments" \
  -H "Authorization: Bearer $FIKEN_API_KEY" \
  -F "filename=Invoice.pdf" \
  -F "attachToSale=true" \
  -F "file=@/path/to/Invoice.pdf;type=application/pdf"

C. Fetch and filter Folio card transactions

curl -s "https://api.folio.no/v2/events?startDate=2025-01-01&endDate=2025-06-30" \
  -H "Authorization: Bearer $FOLIO_API_KEY"

The v2 REST API does not provide a search parameter on /events. Fetch by date range and filter client-side.

Prefer structured event fields such as cardAuthorization.merchantName when available. Use transactions[].description as a fallback for parsing card suffix, currency, foreign amount, and exchange rate.

D. Upload attachment to a Folio event

Folio uses raw binary body — NOT multipart/form-data:

curl -X POST "https://api.folio.no/v2/events/{eventId}/attachments" \
  -H "Authorization: Bearer $FOLIO_API_KEY" \
  -H "Content-Type: application/pdf" \
  -H 'Content-Disposition: attachment; filename="Invoice.pdf"' \
  --data-binary @/path/to/Invoice.pdf

E. Mark a Folio event complete

curl -X POST "https://api.folio.no/v2/events/{eventId}/complete" \
  -H "Authorization: Bearer $FOLIO_API_KEY"

Returns HTTP 202 (Accepted).

F. Search Gmail for invoices

gws gmail users messages list --params '{"userId":"me","q":"vendor invoice 2025"}'
gws gmail users messages get --params '{"userId":"me","id":"MSG_ID","format":"full"}'
gws gmail users messages attachments get \
  --params '{"userId":"me","messageId":"MSG_ID","id":"ATTACHMENT_ID"}'

Gmail attachment data is URL-safe base64: replace - with +, _ with /, add = padding before decoding.

G. Create a sale in Fiken (e.g. Vipps settlements)

curl -X POST "https://api.fiken.no/api/v2/companies/{slug}/sales" \
  -H "Authorization: Bearer $FIKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2025-11-06",
    "kind": "external_invoice",
    "currency": "NOK",
    "lines": [{
      "description": "Vipps settlement 2005799",
      "netPrice": 159920,
      "vat": 39980,
      "account": "3000",
      "vatType": "HIGH"
    }],
    "customerId": 12345678,
    "paid": true,
    "totalPaid": 199900,
    "paymentAccount": "1960:10002",
    "paymentDate": "2025-11-06"
  }'

totalPaid is required when paid: true.

Automation Strategies

For detailed patterns on batch processing, dedup logic, and vendor classification, see automation-patterns.md.

For complete API reference and gotchas, see api-reference.md.

Batch booking card charges

The most powerful automation: classify all card charges by vendor keyword, determine the correct Fiken account and VAT type, and create purchases in bulk.

  1. Fetch all Folio events for the period (split into H1/H2 for large sets)
  2. Filter for card charges (outgoing, identified by card number prefix)
  3. Classify each by vendor keyword → Fiken account + VAT type
  4. Fetch existing Fiken purchases to avoid duplicates (match on date + amount)
  5. Create cash_purchase for each unbooked charge with paymentAccount matching the bank card account
  6. Handle duplicate amounts on same date by counting occurrences

Folio → Fiken Superføring

When you create a Fiken purchase/sale with the correct paymentAccount, it auto-matches the bank line in Fiken's "Superføring" (bank feed matching). This eliminates manual bank reconciliation.

Personal card expenses (Privatutlegg)

For business expenses paid with a personal card, book in Fiken with paymentAccount: "2062". This creates a liability that can be reimbursed.

forum用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价

统计数据

安装量1
评分3.5 / 5.0
版本
更新日期2026年4月8日
对比案例1 组

用户评分

3.5(0)
5
0%
4
0%
3
0%
2
0%
1
0%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code

时间线

创建2026年4月8日
最后更新2026年4月8日