How do I set the event type, summary and timestamp of events from my own webhook payloads?
Tares lets you set all three on a webhook source with four config fields: event_type or event_type_field for the type, text_template for the summary, and event_time_field for the timestamp. Tares stores the payload lossless, so these fields shape how each event is labeled and read without changing what you send. Add them to the source config, post a sample payload, and check the result under Recent events.
How it works
A webhook source in Tares accepts JSON posted to its ingest URL: one object, a list, or NDJSON. Every event keeps its full payload. Four optional config fields control how each event is described:
event_typesets a fixed event type for every event from the source. The default iswebhook_event.event_type_fieldnames a payload field to read the event type from, for exampleaction. A payload with"action": "deploy"then produces an event of type deploy.text_templaterenders a summary line from payload fields. A template that joins theactionandsenderfields turns the payload below into a line like “deploy by ci”.event_time_fieldnames a payload field that holds an ISO-8601 timestamp, such as2024-01-01T00:00:00Z. Tares uses that field as the event time.
Use a fixed event_type when every post means the same thing. Use event_type_field when one producer sends several kinds of event and the payload says which. Labels work alongside these fields: each label maps a payload field into the envelope, and you mark one label primary. For more on how sources feed investigation and alerting, see AI SRE.
Set it up
- Open Sources, choose Add source, then pick webhook. You can also ask a connected agent to create a webhook source, which calls
create_sourceand returns the ingest URL. Another route isPOST /api/sourceswith the same object, and the response includes theingest_key. - Add the event fields to the source config. This example reads the type from
actionand builds the summary fromactionandsender:
- name: ci-events
connector: webhook
config:
event_type_field: action
text_template: '{action} by {sender}'
labels:
- { name: pipeline, field: pipeline, primary: true }- To take the event time from your payload, add
event_time_fieldwith the name of the field that carries the timestamp. This example assumes your payload has asent_atfield:
- name: ci-events
connector: webhook
config:
event_type_field: action
text_template: '{action} by {sender}'
event_time_field: sent_at
labels:
- { name: pipeline, field: pipeline, primary: true }- If you want one fixed type instead, set
event_typeto your own value and leave outevent_type_field. - Copy the ingest endpoint from the source page and post a sample payload to it:
curl -X POST http://localhost:8787/ingest/<ingest_key> \
-H 'Content-Type: application/json' \
-d '{"action": "deploy", "sender": "ci", "pipeline": "web"}'- If you use
event_time_field, include that field in the payload, for example asent_atvalue in ISO-8601 form next toaction,senderandpipeline. - Open the source page and read Recent events to confirm the type, summary and time look right. Fields shows which payload fields arrive and how often, which helps you pick reliable field names.
For a push source, test_source takes no payload. It only returns the ingest endpoint and does not check your mapping, so the sample post in step 5 is how you verify it.
On a Tares instance with auth on, the sender uses a Bearer Authorization header holding an ingest-scoped API key. Without auth, the plain post above works as shown. The full field reference is on the webhook connector page.
What you get
- Every event from your own producers carries a type you chose, either one fixed value or a value read from each payload.
- Each event has a readable one-line summary built from the payload fields you name.
- Events can carry the timestamp your producer recorded instead of relying on anything else.
- The full payload stays stored lossless, so fields you did not map into the type, summary or time are still there.
- Recent events and Fields on the source page show you the result right after your first post, so you can adjust the config quickly.
When something else fits
- If the sender is a vendor with its own payload shape, the same four fields apply, but the vendor’s deliveries reach Tares through the webhook connector and a vendor setup.
- If you need to pull data on a schedule from a JSON endpoint instead of receiving posts, the http_poll connector is the better fit.
- If your producer speaks OpenTelemetry, send it over OTLP instead of mapping fields by hand.
Related
Still stuck? Get help