@stackbit/contentful-listener
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Contentful Listener

The Contentful listener listens for content changes in Contentful and invokes the provided callback when such changes occur.

Usage:

import { ContentfulListener } from '@stackbit/contentful-listener';

const contentfulListener = new ContentfulListener({
    spaceId: process.env.CONTENTFUL_SPACE_ID,
    accessToken: process.env.CONTENTFUL_PREVIEW_API_KEY,
    environment: 'master',
    host: 'preview.contentful.com',
    pollingIntervalMs: 1000,
    callback: (result: CallbackResponse) => {
        // Do something
    }
});

The result is a an object having the following interface, very similar to Contentful's Sync API response:

export interface CallbackResponse {
    entries: Array<Entry<any>>;
    assets: Array<Asset>;
    deletedEntries: Array<Entry<any>>;
    deletedAssets: Array<Asset>;
}

Package Sidebar

Install

npm i @stackbit/contentful-listener

Weekly Downloads

284

Version

0.1.0

License

MIT

Unpacked Size

16.3 kB

Total Files

9

Last publish

Collaborators

  • bwwhite
  • bob_netlify
  • noahcrowley-netlify
  • greglobinski
  • seancdavis
  • merlyn_at_netlify
  • cmparsons
  • suzanneaitchison
  • ryanbonial
  • stackbitjoe
  • arseny.gurevich
  • smnh
  • tomasb
  • rodikh
  • berdav
  • stackbit-admin
  • vitaliyr
  • denar90
  • youvalv