GitXplorerGitXplorer
j

prismic-lambda-webhook

public
8 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
a1b88205e75a9ccc57f31a3b5bbe9d429426bdc1

Release 0.2.0

jjuhamust committed 8 years ago
Unverified
15745e71b9803aa8c6b3e2d4cd483b7cac012e7d

Added Prismic build example

jjuhamust committed 8 years ago
Unverified
2a080863603898ec2f9589a06b4745eebe038434

Decreased the image size

committed 8 years ago
Unverified
7d303da9ea7f0e098cbf01d27d941946a79ea0d7

Fixed image paths

committed 8 years ago
Unverified
324ecbcfbf3c4d1ae1ec16c65aa368353359c68f

Added webhook images

committed 8 years ago
Unverified
9e8070c88f6627255be6667434af815fa896fb1d

Improved the documentation

jjuhamust committed 8 years ago

README

The README file for this repository.

Prismic.io Lambda Webhook

This repository contains the AWS Lambda based handler for Prismic.io webhooks that are run whenever the content is changed in Prismic. Handy for building/publishing content using AWS Services.

Build Status

Setup

  • Install Node 6.10 (usage of NVM or n highly suggested!)
  • Install Serverless 1.12: npm i -g serverless@1.12 (likely to work with newer versions, too)
  • Clone this repo: git clone https://github.com/juhamust/prismic-lambda-webhook.git
  • Install dependencies: cd prismic-lambda-webhook && npm install -D
  • Run the tests (optional): npm test
  • Set valid values in env.yml (or create copy like local.yml and use --env=local while running commands). NOTE: API token is only needed if you want to use the actual sns -based handler example
    PRISMIC_API_ENDPOINT: https://my-repo.prismic.io/api
    PRISMIC_API_TOKEN: see-prismic-api-settings
    PRISMIC_WEBHOOK_SECRET: my-secret
  • Deploy the service: sls deploy --profile=myawsprofile aws webhook endpoint
  • Copy the generated endpoint and your PRISMIC_WEBHOOK_SECRET and place them into Prismic.io Webhook settings prismic webhook endpoint
  • Tryout the trigger: It should be successfull. Check also AWS CloudWatch logs.

Usage

Sequence in short:

  1. User changes content in Prismic.io service
  2. Prismic triggers the webhook into address defined in settings.
  3. Webhook is handled (and authorized) by simple AWS Lambda based endpoint
  4. Lambda triggers SNS message with topic: PRISMIC_LAMBDA_WEBHOOK
  5. Another service/lambda/whatever in AWS is triggered by the SNS (see serverless.yml and build.js for example)

Changelog

0.2.0

  • Added Prismic.io build example
  • Improved Serverless settings/options

0.1.0

  • Initial release

License

MIT License