Using WebHook - Beta

Overview

An integration can now subscribe to events, enabling a real-time user experience with updates. This will significantly ease the capture of changes, particularly when dealing with row deletions, which are challenging to capture with the normal API.

The provided models are similar to other models but are simplified to make operations faster. Notably, attachments (e.g., files) are omitted from the models.

Update Event

In the Update event, only the most relevant properties will trigger a change message. For example, changing the description of an account used in vouchers will not trigger an update message on the vouchers.

It is possible to retrieve WebHook messages for up to five days back if they were not delivered or received due to technical reasons. This can be done using the endpoint:

/WebHook/v2/Notifications

If technical errors occur, synchronization can be performed manually, retrieving messages day by day for up to five days back.

Supported webhooks

The following webhooks are supported:

  • Article
  • Customer
  • Project
  • Supplier
  • Voucher
Supported Events

The following events are supported:

  • All
  • Create
  • Update
  • Delete

NOTE: If an integration is deactivatet, please unsubscribe before its deleted.

Subscribe to an event

In this version, it is only possible to subscribe to events on Voucher.

authHeader Required, can be e.g. "Authorization" or something else.
authHeaderValue Required, is the token, key etc. It is recommended to change this often. Just reposted the subscription.
callbackUrl Required. It is NOT recommended to have authentication of any kind in the url. Https is required.
eventVerb Required, valid values: All, Create, Update and delete.
errorEmail Is the e-mail you want to receive errors on when its failures when delivering WebHook notifications. If this is omitted, no send buffer and retry mechanisms will be activated.

Example

{
 "authHeader": "Authorization",
 "tag": " Our reference 56335",
 "authHeaderValue": "Basic LJJj79jlkjlknmvvnv&&&lllL==",
 "callbackUrl": "https://webook.firmatetmitt.no/receiver",
 "errorEmail": "minsin@firmaetmitt.no",
 "eventVerb": [
 "all"
 ],
 "subscription": "voucher"
}

WebHook Notification message

integrationKey The same key as in the integration.
clientKey The same key as in the integration.
tag is the same that can be used in subscribers.
subscriptionObject The object to which the subscription applies..
event The event: Create, Update or Delete
eventTime The time the event occurred
data is the data model itself. It is delivered as text. Properties that have the value Null are always omitted. Keep this in mind when you serialize data into your data model.

Example

{
 "integrationKey": "159c6b25-2627-4f27-8197-ee097835e2ef",
 "clientKey": "25508d90-7c58-49cd-8baf-7274a3a0420c"
 "tag": "Our reference 56335",
 "subscription": "Voucher",
 "event": "delete",
 "eventTime": "2024-08-23T11:00:32.2216966Z",
 "data": "{\"Id\":4220,\"VoucherNumber\":967,\"AccountNumber\":\"20003\"}"
}

Article subscription

To see details as Accounting or GroupAffiliations, article must be retrieved via Article/v2/.
Se detaljer om article her: Article

Example

{
    "id": 808482,
    "articleNumber": "9995272",
    "name": "Fish",
    "articleType": "normal",
    "salesPrice": 764.57,
    "invoiceStatus": "rejected",
    "metadata": {
        "description": "solutions",
        "ean": "1234567890128",
        "netWeight": 100,
        "grossWeight": 20,
        "netVolume": 5,
        "grossVolume": 5,
        "supplierArticleNumber": "A523",
        "supplierArticleName": "Suppebolle"
    },
    "unit": "stk",
    "showInApi": true,
    "active": true
}

Customer subscription

To see details as GroupAffiliations and HourRegistrations customer must be retrieved via Customer/v2/.
Se detaljer om customer her: Customer

Example

 {
        "id": 13017,
        "name": "Christoffer Aleksander Nielsbakken",
        "externalId": "k-1266",
        "customerNumber": "10000",
        "vatNumber": "395131656M",
        "pidNumber": "120236",
        "hourAttestationMobile": "36 23 56 45",
        "show": true,
        "ourSupplierNumber": "20053",
        "contractEndDate": "2024-02-28T00:00:00",
        "budgetAmount": 123000.00,
        "address": {
            "address1": "Olsbakken 1",
            "address2": "Etasje 1",
            "address3": "Dør 4",
            "zipCodeKey": "9310",
            "zipCodeName": "SØRREISA",
            "country": "Norway"
        },
        "contactInfo": {
            "phone1": "99887755",
            "phone2": "99887755",
            "phone3": "99887755",
            "mobile": "99887755",
            "email": "al@duett.no",
            "homepage": "http://hjemmesiden.no"
        },
        "contactPerson": {
            "name": "Ærlend Ødegard",
            "phone1": "99887755",
            "phone2": "99887755",
            "phone3": "99887755",
            "mobile": "99887755",
            "email": "al@duett.no"
        },
        "paymentInfo": {
            "invoiceSendOption": "autoTrans",
            "invoiceEmail": null,
            "noEInvoice": null,
            "ftpServer": null,
            "ftpUserName": null,
            "ftpPassword": null,
            "ftpDirectory": null,
            "ftpFileName": null,
            "ftpFileFormat": "pdf"
        },
        "invoiceInfo": {
            "bankAccountNumber": "30896737372",
            "currencyCode": "SEK",
            "payType": "invoice",
            "payDays": 15,
            "creditLimit": "250000.00",
            "miscellaneousCustomer": false,
            "collectiveInvoice": false,
            "notificationAutoPay": "bank",
            "useNoVATOnInvoice": false,
            "noVatTaxUsage": null
        }
    }

Project subscription

Project is a carrier. Project Manager is an employee and can be retrieved from the Employee endpoint.
Se detaljer om customer her: Project

Example

{
        "Id":98,
        "Key":",300",
        "Name":"Ny kornsilo",
        "StartDate":"2021-10-27T15:00:00",
        "EndDate":"2021-11-27T15:00:00",
        "ActualEndDate":"2021-12-27T15:00:00",
        "ContractSum":100000.00,
        "Description":"Kontraktslagring av korn for Felleskjøpet",
        "CustomerId":13577,
        "ProjectLeaderCarrierId":1053,
        "CarrierId":1056
}

Supplier subscription

To see details as GroupAffiliations supplier must be retrieved via Supplier/v2/.
Se detaljer om supplier her: Supplier

Example

 {
        "id": 13586,
        "externalId": "s-2355",
        "supplierNumber": "20485",
        "name": "Traktor AS",
        "customer": null,
        "ourCustomerNumber": null,
        "vatNumber": "155110678",
        "pidNumber": "12060080192",
        "bankAccountNumber": "91554827050",
        "agreementAmount": null,
        "agreementExpiresDate": null,
        "useForeignBank": false,
        "foreignBankInfo": {
            "iban": null,
            "bicSwift": null,
            "bankCode": null,
            "bankName": null,
            "address": null,
            "address2": null,
            "abroadZipCode": null,
            "abroadZipCodeName": null,
            "countryCode": null,
            "payType": null,
            "costCoverage": null
        },
        "address": {
            "address1": "Versjon 2 veien 140",
            "address2": "address2",
            "address3": "address3",
            "isForeign": false,
            "zipCodeKey": "9310",
            "zipCodeName": "SØRREISA",
            "countryCode": "NO",
            "abroadZipCode": null,
            "abroadZipCodeName": null
        },
        "contactInfo": {
            "phone1": "82424122",
            "phone2": "89998888",
            "phone3": "89997777",
            "mobile": "88888888",
            "email": "per.jensen@epost.com",
            "homepage": "http://vg.com"
        },
        "contactPerson": {
            "name": "Janne Pedersen",
            "phone1": "89992222",
            "phone2": "82321231",
            "phone3": "82314213",
            "mobile": "88888888",
            "email": "notrealemail@example.com"
        },
        "ean": "1235",
        "show": true
    }

Voucher subscription

Fields that are not part of the change trigger are: AccountName, AccountType, Name, nor details about Carrier and CarrierType.
To see details as attachments or ChangeLogg, vouchers must be retrieved via Report/v2/voucher.
Se detaljer om voucher her: VoucherReport

Example

{
    "id": 698,
    "voucherNumber": 1,
    "accountNumber": "2050",
    "accountName": "Annen egenkapital",
    "accountType": "account",
    "voucherDate": "2023-12-31T00:00:00",
    "voucherYear": "2023",
    "lockVoucher": false,
    "carriers": [{
        "id": 1037,
        "name": "Huels MD, Marc",
        "key": "102",
        "carrierTypeId": 18,
        "carrierType": {
            "id": 18,
            "carrierTypeKind": "employee",
            "name": "Ansatt",
            "usedInAccounting": true,
            "usedInHour": true,
            "usedInInvoice": true,
            "usedInLedger": true,
            "usedInSalary": false,
    }],
    "lineNumber": 1,
    "refNumber": "17885",
    "description": "Justering av annen egenkapital",
    "name": "Annen egenkapital",
    "taxCode": 0,
    "dueDate": "2024-02-28T00:00:00.000",
    "amountNetto": 11541.30,
    "amountGross": 11541.30,
    "kid": "6542223335558874444",
    "accountingPeriod": 1,
    "restAmount": 1200,
    "currencyGross": 1352.20,
    "currencyCode": "LRE",
    "currencyRate": "2024-02-28T00:00:00",
    "currencyRestAmount": 14.15,
    "ledgerState": "blank",
    "reminderDate": "2024-02-28T00:00:00",
    "reminderState": "blank",
    "reminderStop": "2026-02-28T00:00:00",
    "payType": "cach",
    "quantity1": "12",
    "quantity2": "10",
    "voucherType": {
        "id": 290,
        "key": 1,
        "name": "Nøytral postering",
        "type": "periodic",
        "accountingType": "taxAndFinance",
        "show": true
    },
    "voucherCategory": "voucher",
    "debtCaseId": "INKV98876",
    "invoiceFlowStatus": "blank",
    "payedFromBankAccount": "1822.12.36554",
    "bankAccount": "1822.15.336658"
}