[Yandex Cloud documentation](../../../index.md) > [Monium](../../index.md) > Alerts > Step-by-step guides > Creating a notification channel that invokes a function

# Creating a notification channel that invokes a function

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:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), go to the folder containing the resources you monitor in Monium.Metrics.
  1. Navigate to **Cloud Functions**.
  1. [Create a function](../../../functions/operations/function/function-create.md) and a [function version](../../../functions/operations/function/version-manage.md).
  1. In the settings, enable [asynchronous invocation](../../../functions/operations/function/function-invoke-async.md).
  1. [Create a service account](../../../iam/operations/sa/create.md) with the `functions.functionInvoker` and `functions.viewer` roles. You will need it to invoke your function.
  1. Go to **Monium** and select **Notification methods** on the left.
  1. At the top right, click **Create** → **Notification channel**.
  1. Enter a name for your notification channel.
  1. From the **Method** list, select **Cloud Functions**.
  1. From the **Service account** list, select an account for running the function.
  1. Click **Create**.

{% endlist %}

## Message format when invoking a function in Cloud Functions {#function-invoke-payload}

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](../../../functions/lang/python/handler.md):

```json
{
    "alertId": "",
    "alertName": "",
    "folderId": "",
    "alertStatus": "",
    "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).
* `alertStatus`: [Alert status](../../concepts/alerting/alert.md#alert-statuses) (text).
* `annotations`: Values of annotations for the fired alert (`key:value` dictionary).

For an example of invoking a function, see [Webhook using Cloud Functions](alert-call-function.md).