0.1.6 • Published 11 months ago

serverless-webhooks v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Serverless Webhooks Plugin

This is a plugin to expand the Serverless Framework with webhooks

Installation

serverless plugin install --name serverless-webhooks

Quick start

Once installed, define you webhooks in serverless.yml

service: my-app

provider:
  name: aws

plugins:
  - serverless-webhooks

functions:
  zuora-consumer:
    handler: src/zuora-consumer.handler
    events:
      - eventBridge:
          eventBus: ${webhooks:eventBus}
          pattern:
            source:
              - zuora
            detail-type:
              - workflow_GET_example.finished
              - workflow_POST_example.finished
custom:
  webhooks:
    zuoraWorkflowGetExampleFinished:
      route:  
        method: GET
        path: /webhooks/zuora/workflow_GET_example.finished
      source: zuora
      detailType: workflow_GET_example.finished
      detail: $request.querystring.detail
    zuoraWorkflowPostExampleFinished:
      route:  
        method: POST
        path: /webhooks/zuora/workflow_POST_example.finished
      source: zuora
      detailType: workflow_POST_example.finished
      detail: $request.body

How it works

This configuration will create:

  • A shared event bus (referenced in the variable ${webhooks:eventBus}).
  • 2 routes (without an authorizer) in the default API Gateway as follows:
    1. GET /webhooks/zuora/workflow_GET_example.finished, which will receive the event detail from the query string parameter named detail.
    2. POST /webhooks/zuora/workflow_POST_example.finished, which will receive the event detail from the body of the request.
  • The zuora-consumer function will be triggered by any event with the source zuora and detailType workflow_GET_example.finished or workflow_POST_example.finished.

Issues

Feel free to open any relevant issue on Github.

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago