Best way to add metadata to an incident

Hi. In my company, we have an internal tool that allows us to trigger incidents in PagerDuty using the API. There is some important metadata about the incidents that we add as custom fields to the event that triggers the incident. One important use case is to be able to retrieve the incident based on this metadata. So far the only way we have found is to list all incidents, then retrieve the log entries for each one and inspect them searching for the metadata.

Is there any way to add metadata to the incident? If would be awesome to do it when triggering based on the data in the event, but I can also live when the option to do it by means of a webhook that receives the incident triggered event.

The best way to enrich your incidents is to send in well configured events through our Event Orchestration rules. From here, you can extract and generate new fields, values, titles, etc. and use those in incident creation. You can then get this data via the log entries, but specifically the first_trigger_log_entry will be the only one with this data. This data is not available today in a webhook v3 event payload. It is available in webhook v2 trigger webhooks if needed from there.