This is an example on how to deploy a webhook transformer on AWS API Gateway and Lambda to post from Contentful to Slack. This is not a fully fledged application but rather a couple of snippets on how the lambda function might look like and how the api and integration on AWS API Gateway is defined.
Contentful is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.
- src/lambda.js: The lambda function to transform the payload
- aws-api-gateway-setup/swagger.json: Swagger definition of the API
- aws-api-gateway-setup/integration.json: Integration config used in AWS API Gateway
- You need an account at AWS and the AWS CLI setup with your AWS credentials
- node and npm installed
- A space at contentful.com with an API key for the management API with read access.
- A slack channel with an incoming webhook configured
- Create the webhook target API at AWS API Gateway, similar to what you see in swagger.json
- Create your AWS Lambda function and connect it to the API from 1.
- Setup the integration for the headers, similar to what you see in integrations.json. Deploy your API.
- Setup a webhook in your Contentful space and point it to your API from 1
- Edit lambda.json and replace
cmaToken
with your contentful management API token andslackURL
with the url of your incoming webhook on slack
- Clone or fork this repository
- run
npm install
to install dependencies - run
npm run setup
to createdist
folder - run
npm run test
to locally execute your function - run
npm run bundle
package lambda function and node_modules in a zip - run
npm run deploy
to upload the lambda function to AWS using the aws-cli
###License
Copyright (c) 2016 Contentful GmbH. Code released under the MIT license. See LICENSE for further details.
###Disclaimer / Maintenance
This is a project created for demo purposes and not officially supported. Report problems via the issues page but please don't expect a quick and prompt response.