What request body formats can I POST to a webhook source, and how do I check my label mapping before going live?
Tares accepts one JSON object, a list of JSON objects or NDJSON posted to a webhook source’s ingest URL, and it stores the payload lossless. To check your label mapping, post a sample payload to that URL and read Recent events and Fields on the source page. Fields shows which payload fields arrive and how often, so you can fix the mapping before real traffic depends on it.
How it works
The webhook connector is the catch-all push connector for anything that can send an HTTP request: CI systems, GitHub webhooks, cron jobs and your own services. Each source has its own ingest URL that ends in the source’s ingest key.
- Body formats. Producers POST one JSON object, a list of objects, or NDJSON.
- Lossless storage. Tares keeps the whole payload as it arrived. Labels do not trim it. They map payload fields into the envelope so Tares can correlate on them.
- Labels. You declare one label per payload field you want to correlate on, and you mark one as
primary. - Event shape. Four optional settings shape each event:
event_typeis a fixed type and defaults towebhook_event.event_type_fieldreads the type from a payload field such asaction.text_templaterenders a text line from payload fields.event_time_fieldnames the payload field that holds an ISO-8601 timestamp.
For a push source such as the webhook, test_source takes no payload. It only returns the ingest endpoint, so it does not check your label mapping. The check is a real POST followed by a look at what arrived.
Set it up
- Create the source. Ask a connected agent, for example: “Use tares to create a webhook source for my CI events, keyed by the payload’s pipeline field.” The agent calls
create_sourceand returns the ingest URL. You can also use Sources, then Add source, then webhook, in the console, orPOST /api/sourceswith the same object. The response includes theingest_key. - Declare the labels and event settings. Mark one label
primary:
- name: ci-events
connector: webhook
config:
event_type_field: action
text_template: '{action} by {sender}'
labels:
- { name: pipeline, field: pipeline, primary: true }- Save the source and copy the ingest endpoint from the source page.
- Post a sample payload that looks like your real one:
curl -X POST http://localhost:8787/ingest/<ingest_key> \
-H 'Content-Type: application/json' \
-d '{"action": "deploy", "sender": "ci", "pipeline": "web"}'- Open the source page and read Recent events. Confirm the event type, the rendered text and the label values are what you expect.
- Read Fields. It shows which payload fields arrive and how often. Use it to pick a reliable key: a field that shows up in every event is a safe primary label, and a field that appears only sometimes is not.
- If a label is empty or a field is missing, edit the source and post the sample again. Point your real producer at the URL once the mapping looks right.
When Tares has auth on, the sender uses a Bearer Authorization header holding an ingest-scoped API key. Without auth, the request needs no header. The same applies to a list or NDJSON body, and you can send one by changing only the -d value.
What you get
- Producers can send whichever shape is easiest for them: a single object, a batch as a list, or a stream as NDJSON.
- The full payload stays stored, so a field you did not map is still there and you can add a label for it later.
- You see the mapping result before going live: Recent events shows each event as Tares stored it, and Fields shows how often each payload field arrives.
- You choose the primary label from evidence instead of guessing which field is always present.
For how a source feeds monitoring and triggers, see AI SRE.
When something else fits
- If you want Tares to pull from a JSON endpoint on a schedule instead of receiving posts, use the
http_pollconnector. - If the sender is Alertmanager, the
alertmanagerconnector turns each routed alert into its own event. The webhook connector is the general choice for any other sender.
Related
Still stuck? Get help