Integrate with your Next.js website

View integration

Integrating with Next.js is easy. This is because Next.js uses Node.js to generate dynamic, or static pages which come from the server.

Just make sure you call Previewify from either getServerSideProps or getStaticProps.

Here's an example using getServerSideProps:

import { previewify } from '@/lib/previewify'

export async function getServerSideProps(context) {
    const preview = previewify.signedImageUrl({
        siteId: 167,
        templateId: 234,
        fields: {
            'previewify:title': 'Hello from Node.js!',
            'previewify:subtitle': 'This is an example...',

    return {
        props: { preview },

export default function Home({ preview }) {
    return (
            <meta name="twitter:image" content={preview} />
            <meta property="og:image" content={preview} />

We recommend to make your own lib/previewify.js instance which you can import across components, otherwise you'd need to specify the API token each time you generate an image.

// lib/previewify.js

const { Previewify } = require('@flowframe/node-previewify')

const previewify = new Previewify({ apiToken: '<YOUR_API_TOKEN>' })

export { previewify }