Skip to content

Migrating from older version

Igor Balos edited this page Feb 8, 2024 · 3 revisions

There has been a lot of improvements in version 2 of the library which we migrated to Typescript. However migration to it should be pretty easy.

All you would need to do is migrate clients if you would like to. In the latest version of the library, we also provide backward compatibility.

Version 1.x clients initialization

let postmark = require("postmark");

let serverToken = "xxxxxx-xxxxxx-xxxxx-xxxxxx";
let accountToken = "yyyyyy-yyyyy-yyyyy-yyyyyy"

let client = new postmark.Client(serverToken);
let accountClient = new postmark.AdminClient(accountToken);

Version 2.x clients initialization

let postmark = require("postmark");

let serverToken = "xxxxxx-xxxxxx-xxxxx-xxxxxx";
let accountToken = "yyyyyy-yyyyy-yyyyy-yyyyyy"

let client = new postmark.ServerClient(serverToken);
let accountClient = new postmark.AccountClient(accountToken);

From then on, you should be good to go. Most of the things will work pretty much the same. For additional details about each method, you can check out code examples at wiki and the detailed typescript documentation which will guide you even further.

Version 3 upgrade

There are significant core library changes in version 3 but no breaking changes compared to version 2.

Version 4 upgrade

There are no breaking code changes here, but we dropped support for old Node versions.