Skip to content

Show webhooks

View as Markdown

A webhook is an HTTP request that a service sends to you when something occurs. streamview makes one event from each webhook. It does not need CloudEvents, an adapter, or Node.js.

streamview does not check the signature of a webhook. It shows each request that arrives.

Run this command:

streamview webhooks

The browser opens. The page is empty until the first webhook arrives.

  1. Run this command in a different terminal:
curl -X POST http://localhost:4747/webhooks/shop \
-H 'Content-Type: application/json' \
-d '{"event":"order.paid","orderId":"ord_1","total":42}'
  1. Read the answer:
{"accepted":true,"type":"shop.order.paid","id":"wh-1a23ad82ed3-0"}
  1. Look at the page. After approximately 2 seconds, the event shows in the lane shop.order.paid.

The address of a webhook is /webhooks/NAME. You select the name. Use one name for each service, for example /webhooks/stripe and /webhooks/github.

The name can have letters, digits, and the characters ., _, and -. The name is the start of the event type, and it is the channel of the event.

streamview finds the kind of the event in the headers or in the body of the webhook. Each kind gets a lane of its own, for example stripe.payment_intent.succeeded and stripe.charge.refunded. See Events from webhooks for the places where streamview looks.

Receive webhooks from a service on the internet

Section titled “Receive webhooks from a service on the internet”

A service on the internet cannot connect to localhost. A tunnel gives your computer a public address. These steps use cloudflared, the tunnel program of Cloudflare. Other tunnel programs work the same way.

  1. Start streamview: streamview webhooks.
  2. Run this command in a different terminal:
cloudflared tunnel --url http://localhost:4747
  1. Find the address in the output. It ends with trycloudflare.com.
  2. In the settings of the service, give this webhook address: the public address, then /webhooks/, then your name.

For example: https://example-words.trycloudflare.com/webhooks/stripe.

The public address can need some seconds before it works.

If the server runs on a computer that the service can connect to, you do not need a tunnel. Start streamview with --host 0.0.0.0. See Share a view.

Add icon to the address that you give to the service. An emoji is the simplest icon:

http://localhost:4747/webhooks/stripe?icon=💳

The value can also be the address of an image. See The icon of a lane.

If a service does not say what kind of event it sends, the type is only the name. To give the type, add ?type= to the address:

https://example-words.trycloudflare.com/webhooks/builds?type=build.finished

All webhooks to this address then have the type build.finished.

streamview connects events that have the same correlation ID. Tell it which field of the body has the ID.

For all addresses, start streamview with --correlation-field:

streamview webhooks --correlation-field orderId

For one address, add ?correlation-field= to the address:

http://localhost:4747/webhooks/stripe?correlation-field=data.object.metadata.order_id
  • Use a period to go into an object, as in data.object.metadata.order_id.
  • Use a comma between two or more fields. streamview uses the first field that the body has.

When two services send the same ID, the trace shows their webhooks together.

Each streamview server that stores events accepts webhooks: kafka, nats, rabbitmq, serve, and demo. Send the webhooks to the same port. Their lanes show below the lanes of the broker.