This is the official PreviewLinks client for Node.js.
You can install the package via NPM:
npm install @previewlinks/node-previewlinks
const { PreviewLinks } = require('@previewlinks/node-previewlinks')
const previewlinks = new PreviewLinks({ apiToken: '<YOUR_API_TOKEN>' })
// List sites
previewlinks
.listSites()
.then(response => response.data)
// Show site
let siteId = 1
previewlinks
.showSite(siteId)
.then(response => response.data)
// Show site's templates
let siteId = 1
previewlinks
.listSiteTemplates(siteId)
.then(response => response.data)
// Generate a direct image URL (useful for downloading and storing images yourself)
let siteId = 1
let templateId = 1
let fields = {
'previewlinks:title': 'Hello from Node.js!',
'previewlinks:subtitle': 'This is an example...',
}
previewlinks
.downloadImage({
siteId,
templateId,
fields,
})
.then(response => response.data)
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.