# alerts namespace

Stay organized with collections

## Functions

| Function | Description |
| --- | --- |
| [onAlertPublished(alertType, handler)](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.md#alertsonalertpublished/index.html) | Declares a function that can handle Firebase Alerts from CloudEvents. |
| [onAlertPublished(options, handler)](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.md#alertsonalertpublished/index.html) | Declares a function that can handle Firebase Alerts from CloudEvents. |

## Interfaces

| Interface | Description |
| --- | --- |
| [AlertEvent](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.alertevent.md#alertsalertevent_interface/index.html) | A custom CloudEvent for Firebase Alerts (with custom extension attributes). |
| [FirebaseAlertData](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.firebasealertdata.md#alertsfirebasealertdata_interface/index.html) | The CloudEvent data emitted by Firebase Alerts. |
| [FirebaseAlertOptions](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.firebasealertoptions.md#alertsfirebasealertoptions_interface/index.html) | Configuration for Firebase Alert functions. |

## Namespaces

| Namespace | Description |
| --- | --- |
| [appDistribution](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.appdistribution.md#alertsappdistribution_namespace/index.html) |  |
| [billing](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.billing.md#alertsbilling_namespace/index.html) |  |
| [crashlytics](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.crashlytics.md#alertscrashlytics_namespace/index.html) |  |
| [performance](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.performance.md#alertsperformance_namespace/index.html) |  |

## Type Aliases

| Type Alias | Description |
| --- | --- |
| [AlertType](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.md#alertsalerttype/index.html) | The underlying alert type of the Firebase Alerts provider. |

## alerts.onAlertPublished()

Declares a function that can handle Firebase Alerts from CloudEvents.

**Signature:**

```
export declare function onAlertPublished<T extends {
    ["@type"]: string;
} = any>(alertType: AlertType, handler: (event: AlertEvent<T>) => any | Promise<any>): CloudFunction<AlertEvent<T>>;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| alertType | [AlertType](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.md#alertsalerttype/index.html) | the alert type or Firebase Alert function configuration. |
| handler | (event: [AlertEvent](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.alertevent.md#alertsalertevent_interface/index.html) <T>) => any \| Promise<any> | a function that can handle the Firebase Alert inside a CloudEvent. |

**Returns:**

[CloudFunction](/content/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction.md#cloudfunction_interface/index.html) < [AlertEvent](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.alertevent.md#alertsalertevent_interface/index.html) <T>>

A function that you can export and deploy.

## alerts.onAlertPublished()

Declares a function that can handle Firebase Alerts from CloudEvents.

**Signature:**

```
export declare function onAlertPublished<T extends {
    ["@type"]: string;
} = any>(options: FirebaseAlertOptions, handler: (event: AlertEvent<T>) => any | Promise<any>): CloudFunction<AlertEvent<T>>;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| options | [FirebaseAlertOptions](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.firebasealertoptions.md#alertsfirebasealertoptions_interface/index.html) | the alert type and other options for this cloud function. |
| handler | (event: [AlertEvent](/content/docs/reference/functions/2nd-gen/node/firebase-functions.alerts.alertevent.md#alertsalertevent_interface/index.html) <T>) => any \| Promise<any> | a function that can handle the Firebase Alert inside a CloudEvent. |

**Returns:**

## alerts.AlertType

The underlying alert type of the Firebase Alerts provider.

**Signature:**

```
export type AlertType = "crashlytics.newFatalIssue" | "crashlytics.newNonfatalIssue" | "crashlytics.regression" | "crashlytics.stabilityDigest" | "crashlytics.velocity" | "crashlytics.newAnrIssue" | "billing.planUpdate" | "billing.planAutomatedUpdate" | "appDistribution.newTesterIosDevice" | "appDistribution.inAppFeedback" | "performance.threshold" | string;
```
