> ## Documentation Index
> Fetch the complete documentation index at: https://docs.incident.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom HTTP alert sources

Utilizing a JavaScript expression, you can create an alert source which is able to parse almost any shape of a JSON payload. This is useful for connecting [incident.io](http://incident.io/) to alert sources which we don't have an official integration for yet.

## Creating a custom HTTP alert source

When creating a HTTP alert source, you will have the option to use either **Default** or **Custom** source types. The default mode will cover most scenarios, but if you find that your alerting tool has a set payload, you will want to use the custom HTTP source.

<img src="https://mintcdn.com/incidentio-18bb4170/e2x1yCidKCk3BCKz/images/help-centre/custom-http-alert-sources/screenshot-1.png?fit=max&auto=format&n=e2x1yCidKCk3BCKz&q=85&s=b3f4c4bd4b57745f0bee3f1a8ce8adca" alt="CleanShot 2025-07-23 at 12.54.38@2x.png" width="1316" height="1102" data-path="images/help-centre/custom-http-alert-sources/screenshot-1.png" />

Below the Authentication information, there will be 2 fields which you can configure to extract the required information from a JSON payload.

<img src="https://mintcdn.com/incidentio-18bb4170/e2x1yCidKCk3BCKz/images/help-centre/custom-http-alert-sources/screenshot-2.png?fit=max&auto=format&n=e2x1yCidKCk3BCKz&q=85&s=7e7105424fd197e69942de4ec4d041a4" alt="CleanShot 2025-07-23 at 12.56.37@2x.png" width="986" height="1166" data-path="images/help-centre/custom-http-alert-sources/screenshot-2.png" />

### Transform expression

The transform expression is ES5-compatible JavaScript code that returns an object, matching up with our standard alert schema, having extracted the information from the incoming JSON payload `$`.

The root of the expression will be `source_payload`, so to correctly access the data and set the title for example, you'd need to do:

```javascript theme={null}
return {
  title: $.data.event.title,
};
```

Instead of;

```javascript theme={null}
return {
  title: $.source_payload.data.event.title,
};
```

| Property      | Description                                                                                                |
| ------------- | ---------------------------------------------------------------------------------------------------------- |
| `title`       | The title, or name, of the alert                                                                           |
| `status`      | Status reflecting the state of the alert - one of `resolved` or `firing`                                   |
| `description` | An optional long-text description of the alert, which is rendered alongside the title                      |
| `source_url`  | An optional link to the origin of the alert, such as an alerting dashboard or other source                 |
| `metadata`    | An unstructured object `{ }` that contains additional information for attributes like teams, services etc. |

<Info>
  Expressions which take longer than 250 milliseconds to execute will result in a default alert being created.

  Plain JavaScript expressions are normally executed in under a millisecond.
</Info>

### Deduplication key path

The deduplication key path is a `.` separated pointing us at the property we should use as the deduplication key for an alert.

For the sake of reliability and simplification of configuration, this is not executed as JavaScript.

## Powering attributes & priorities

To power attributes, and priorities, via an expression, you should pull the required information into the `metadata` property.

```javascript theme={null}
return {
  title: $.title,
  metadata: {
    priority: $.priority,
    team: $.team,
  },
};
```

This can be accessed via alert attribute expressions to enrich an alert as with any other alert source.

<Warning>
  Although visible as a fallback, `source_payload` cannot be accessed by attribute expressions.

  Any properties should be pulled up into `metadata` to ensure they're accessible.
</Warning>

## FAQs

<AccordionGroup>
  <Accordion title="What happens if there's an error in the JavaScript?">
    If we hit an error running the transform expression, we will create a default alert, with the whole payload accessible on a `source_payload` property when inspecting the alert.
  </Accordion>

  <Accordion title="What if the deduplication key isn't present in the payload?">
    We will generate a random deduplication key for you so your alert can still be processed, but please note it means **we will not** be able to deduplicate any alerts.
  </Accordion>
</AccordionGroup>
