example

command
v0.0.0-...-5fa6b44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

README

Webhooks Example

This directory contains an example of how the webhooks input and process might be used.

It contains both an input and a process, which are linked together, so that when the webhook input is hit, the process is called which then sends the event on.

In many respects what we have in this example is a proxy for events- which... fine.

You, of course, are free to not do that- this is just an example.

You might build the pipeline:

graph LR;
    db[Sales Database]
    in0[Postgres Input]
    proc0[Container Process: Write to DataWarehouse]
    proc1[Webhook Process: Call Notification Endpoint]
    proc2[Notebook Process: Analyse Data, Produce Report]

    db-->in0
    in0-->proc0
    in0-->proc1
    in0-->proc2

Where the webhook process as defined in this package is used to call some arbitrary endpoint.

Usage

This example uses the dead standard go toolchain:

$ go build
$ ./example

Additionally, the endpoint this example sends events to can be specified in the environment:

$ WEBHOOKS_DESTINATION=https://example.com/blah
$ ./example

(Tools such as https://webhook.site can be used, for instance, to see the returned payload)

To trigger the input, and thus the process, simply run:

$ curl -H 'content-type: application/json' -XPOST -d '{"location":"thingy","operation":"create","id":"0xabadbabe"}' 127.0.1.1:8888/webhooks/webhooks-input-example

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL