Webhook source (HTTP)
This source exposes an HTTP endpoint, meaning it acts as an HTTP server. It can be used as a target endpoint for 3rd-party webhooks from any SaaS app that supports webhooks, or can be used as a generic way to ingest events to TriggerMesh via HTTP. The Webhook source creates an event for each request received.
Compared to the CloudEventsSource, the Webhook source can accept arbitrary data (e.g. any JSON) and does not require the request to conform to the CloudEvents specification.
- Name: all TriggerMesh components need a unique name per namespace.
- Broker: request converted into CloudEvents will be sent to this location.
- EventType: string that identifies the purpose for all messages produced from this source.
- EventSource: string that identifies the origin for all messages produced from this source.
- Basic Auth Username: (optional) HTTP basic authentication username.
- Basic Auth Password (optional) points to a secret that contains the HTTP basic authentication password.
Events produced have the following attributes:
- type: defined by the user in the WebhookSource configuration, e.g.
- source: defined by the user in the WebhookSource configuration, e.g.
- Schema of the
dataattribute: depends on what the client sends to the Webhook
datacontenttypeis set to the
Content-Typereceived at the incoming request
Cloud Event data example (same as received body):
See the Kubernetes object reference for more details.
tmctl to create a Webhook source
Create an HTTP endpoint
We're declaring that events of type
contact.created will be sent to this endpoint. This event type will be part of the event metadata as it flows through TriggerMesh, and can be used later on for routing.
Obtain the URL
Find the Webhook Source URL:
The output should look something like this:
As you can see,
tmctl describe displays useful info about your current configuration. It lists all the sources, targets, and other components you've defined, and their properties.
Copy the webhooksource URL, in this case
http://localhost:59936 (this will vary depending on your environment). Do not confuse this with the Broker's URL.
Send an event over HTTP
We'll use curl here. Remember to replace the endpoint URL with yours.
The event should show up in