Skip to content

Latest commit

 

History

History
 
 

cdk-contentful-webhook

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

cloudcomponents Logo

@cloudcomponents/cdk-contentful-webhook

Build Status cdkdx typescript python

Create, update and delete contentful webhooks with your app deployment

Install

TypeScript/JavaScript:

npm i @cloudcomponents/cdk-contentful-webhook

Python:

pip install cloudcomponents.cdk-contentful-webhook

How to use

import { RestApi } from '@aws-cdk/aws-apigateway';
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import { ContentfulWebhook } from '@cloudcomponents/cdk-contentful-webhook';
import { SecretKey } from '@cloudcomponents/cdk-secret-key';

export class ContentfulWebhookStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const api = new RestApi(this, 'Endpoint');
    api.root.addMethod('POST');

    const accessToken = SecretKey.fromPlainText(process.env.ACCESS_TOKEN as string);

    const spaceId = process.env.SPACE_ID as string;

    const topics = ['Entry.create'];

    new ContentfulWebhook(this, 'ContentfulWebhook', {
      accessToken,
      spaceId,
      name: 'ExampleWebhook',
      url: api.url,
      topics,
      logLevel: 'debug',
    });
  }
}

API Reference

See API.md.

Example

See more complete examples.

License

MIT