firebase_functions.alerts_fn module
Stay organized with collections
Save and categorize content based on your preferences.
Cloud functions to handle events from Firebase Alerts.
Classes
AlertEventclass firebase_functions.alerts_fn.AlertEvent(specversion: str, id: str, source: str, type: str, time: datetime, data: T, subject: str | None, alert_type: str, app_id: str | None) |
---|
Bases: CloudEvent [T ]
A custom CloudEvent for Firebase Alerts (with custom extension attributes).
-
alert_type: str
The type of the alerts that got triggered.
-
app_id: str | None
The Firebase App ID that's associated with the alert. This is optional,
and only present when the alert is targeting a specific Firebase App.
|
Functions
on_alert_publishedfirebase_functions.alerts_fn.on_alert_published(**kwargs) → Callable[[Callable[[AlertEvent[FirebaseAlertData[T]]], None]], Callable[[AlertEvent[FirebaseAlertData[T]]], None]] |
---|
Event handler that triggers when a Firebase Alerts event is published.
Example:
from firebase_functions import alerts_fn
@alerts_fn.on_alert_published(
alert_type=alerts_fn.AlertType.CRASHLYTICS_NEW_FATAL_ISSUE,
)
def example(alert: alerts_fn.AlertEvent[alerts_fn.FirebaseAlertData]) -> None:
print(alert)
- Parameters:
**kwargs (as firebase_functions.options.FirebaseAlertOptions ) -- Options.
- Return type:
typing.Callable
[ [ firebase_functions.alerts_fn.AlertEvent [
firebase_functions.alerts_fn.FirebaseAlertData [
typing.Any ] ] ], None ]
A function that takes a AlertEvent and returns None.
|
Constants
OnAlertPublishedCallablefirebase_functions.alerts_fn.OnAlertPublishedCallable |
---|
The type of the callable for 'on_alert_published' functions.
alias of Callable [[AlertEvent [FirebaseAlertData [T ]]], None ]
|
OnAlertPublishedEventfirebase_functions.alerts_fn.OnAlertPublishedEvent |
---|
The type of the event for 'on_alert_published' functions.
alias of AlertEvent [FirebaseAlertData [T ]]
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-06 UTC.
[null,null,["Last updated 2023-11-06 UTC."],[],[],null,["# firebase_functions.alerts_fn module\n\nCloud functions to handle events from Firebase Alerts.\n\nClasses\n-------\n\n| ### AlertEvent *class* firebase_functions.alerts_fn.AlertEvent(*specversion: str* , *id: str* , *source: str* , *type: str* , *time: datetime* , *data: T* , *subject: str \\| None* , *alert_type: str* , *app_id: str \\| None* ) |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Bases: [CloudEvent](/docs/reference/functions/2nd-gen/python/firebase_functions.core#firebase_functions.core.CloudEvent \"firebase_functions.core.CloudEvent\")\\[T\\] A custom CloudEvent for Firebase Alerts (with custom extension attributes). alert_type*: str* : The type of the alerts that got triggered. app_id*: str \\| None* : The Firebase App ID that's associated with the alert. This is optional, and only present when the alert is targeting a specific Firebase App. |\n\nFunctions\n---------\n\n| ### on_alert_published firebase_functions.alerts_fn.on_alert_published(*\\*\\*kwargs* ) → Callable\\[\\[Callable\\[\\[[AlertEvent](#firebase_functions.alerts_fn.AlertEvent \"firebase_functions.alerts_fn.AlertEvent\")\\[FirebaseAlertData\\[T\\]\\]\\], None\\]\\], Callable\\[\\[[AlertEvent](#firebase_functions.alerts_fn.AlertEvent \"firebase_functions.alerts_fn.AlertEvent\")\\[FirebaseAlertData\\[T\\]\\]\\], None\\]\\] |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Event handler that triggers when a Firebase Alerts event is published. Example: ``` from firebase_functions import alerts_fn @alerts_fn.on_alert_published( alert_type=alerts_fn.AlertType.CRASHLYTICS_NEW_FATAL_ISSUE, ) def example(alert: alerts_fn.AlertEvent[alerts_fn.FirebaseAlertData]) -\u003e None: print(alert) ``` Parameters: : **\\*\\*kwargs** (as [firebase_functions.options.FirebaseAlertOptions](/docs/reference/functions/2nd-gen/python/firebase_functions.options#firebase_functions.options.FirebaseAlertOptions \"firebase_functions.options.FirebaseAlertOptions\")) -- Options. Return type: : typing.Callable \\[ \\[ [firebase_functions.alerts_fn.AlertEvent](#firebase_functions.alerts_fn.AlertEvent \"firebase_functions.alerts_fn.AlertEvent\") \\[ firebase_functions.alerts_fn.FirebaseAlertData \\[ typing.Any \\] \\] \\], None \\] A function that takes a AlertEvent and returns None. |\n\nConstants\n---------\n\n| ### OnAlertPublishedCallable firebase_functions.alerts_fn.OnAlertPublishedCallable |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| The type of the callable for 'on_alert_published' functions. alias of Callable\\[\\[[AlertEvent](#firebase_functions.alerts_fn.AlertEvent \"firebase_functions.alerts_fn.AlertEvent\")\\[FirebaseAlertData\\[T\\]\\]\\], None\\] |\n\n| ### OnAlertPublishedEvent firebase_functions.alerts_fn.OnAlertPublishedEvent |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| The type of the event for 'on_alert_published' functions. alias of [AlertEvent](#firebase_functions.alerts_fn.AlertEvent \"firebase_functions.alerts_fn.AlertEvent\")\\[FirebaseAlertData\\[T\\]\\] |"]]