Creating a notification channel that invokes a function
Written by
Updated at October 29, 2025
You can specify a function in Cloud Functions as the notification method. This function will be invoked when an alert fires or in an escalation as a standard notification channel.
To set up notifications with Cloud Functions:
Management console
- In the management console
, go to the folder containing the resources you monitor in Monitoring. - In the list of services, select Cloud Functions.
- Create a function and a function version.
- In the settings, enable asynchronous invocation.
- Create a service account with the
functions.functionInvokerandfunctions.viewerroles. You will need it to invoke your function. - In the list of services, select Monitoring.
- Click Create channel.
- Enter a name for your notification channel.
- From the Method list, select Cloud Functions.
- From the Service account list, select an account for running the function.
- Click Create.
Message format when invoking a function in Cloud Functions
When invoking a function in Cloud Functions, the alert or escalation will send a JSON message with details of the triggered alert to the event argument in the function entry point:
{
"alertId": "",
"alertName": "",
"folderId": "",
"status": "",
"annotations": {
"key1": "value1",
"key2": "value2"
}
}
alertId: ID of the triggered alert (text).alertName: Name of the triggered alert (text).folderId: ID of the folder where the alert fired (text).status: Alert status (text).annotations: Values of annotations for the fired alert (key:valuedictionary).
For an example of invoking a function, see Webhook using Cloud Functions.