---
schema_version: "1"
id: 62a7765a8986aecd480952ddf8d970f9384803ab201e2e03d27815cd80e9c871
title: Custom Application Alerts and Notifications
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/cloudhub/custom-application-alerts.md
canonical_url: https://docs.mulesoft.com/cloudhub/custom-application-alerts
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 0722583783228b73b99e091498f4e14ec51b0c4b74a4ff1d24ccb883ba04577a
description: MuleSoft Documentation Site
latest: true
---
---
product: CloudHub
---

# Custom Application Alerts and Notifications

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

CloudHub enables you to display notifications from your app in the Runtime Manager console. You can
configure CloudHub to email these notifications as _custom alerts_ to specific people so that they
can fix the underlying problems.

> [!NOTE] Custom alerts and notifications are available only for apps deployed to CloudHub workers.
> They are not available for apps deployed to on-premises servers. See
> [Deployment Options](https://docs.mulesoft.com/runtime-manager/deployment-strategies) for more information about CloudHub
> features.

## Prerequisites

- Deploy your application to CloudHub.

  See [Deploy to CloudHub](https://docs.mulesoft.com/cloudhub/deploying-to-cloudhub)

- For Anypoint Studio 6.x and earlier, enable Maven support for your Mule project.

  All projects in Studio 7.x and later support Maven by default.

## Custom Application Alerts

Alerts enable you to send emails based on your application’s notifications. You can create standard
alerts in Runtime Manager for servers and applications deployed to either CloudHub or on-premises
servers. See [Alerts](https://docs.mulesoft.com/runtime-manager/alerts-on-runtime-manager).

You can also create _custom alerts_ for applications deployed to CloudHub.

To create custom application alerts:

1.  Add Anypoint Connector for CloudHub (CloudHub Connector) to flows in your Mule app in Anypoint
    Studio and configure the notification.

    CloudHub Connector is available for Mule 4 applications.

2.  Deploy the app to CloudHub.

3.  Configure the custom application alerts in Runtime Manager.

### Configure the Notification in CloudHub Connector

In Studio, add and configure CloudHub Connector in your Mule project:

1.  In the **Mule Palette** view, click **CloudHub** and then drag the **Create Notification**
    operation to the application flow for which you want to trigger an alert in the canvas.

2.  In the canvas, click **Create Notification**.

3.  In the **Create Notification** properties window, click the green plus icon (**+**) to the right
    of the **Connector configuration** field.

4.  In the **Global Element Properties** window, configure authentication to Anypoint Platform and
    click **OK**:

    ![Username field in the Global Element Properties window](/mulesoft/current/en-us/cloudhub/_images/alerts-custom-ch-connector.png)

    Figure 1. The arrow shows the **Username** field in the **Global Element Properties** window.

    The connector can use basic authentication or inherited token authentication.

5.  In the **Create Notification** properties window, enter the CloudHub app name in the **Domain**
    field and the notification in the **Message** field:

    ![Message field in the Create Notification properties window](/mulesoft/current/en-us/cloudhub/_images/alerts-custom-ch-connector-notification.png)

    Figure 2. The arrow shows the **Message** field in the **Create Notification** properties
    window.

    For more information about creating a notification with CloudHub Connector, see
    [Creating a Notification](https://docs.mulesoft.com/cloudhub-connector/latest/#creating-notifications).

6.  Deploy the app to CloudHub.

### Create a Custom Alert

In Runtime Manager, bind the custom notification to an alert:

1.  Click **Alerts** in the menu on the left.

2.  Click the blue plus icon (**+**) to create a new alert.

3.  In the **Create an Alert** page, configure your custom alert and click **Submit**:

    ![Applications field in the Create an Alert window](/mulesoft/current/en-us/cloudhub/_images/alerts-custom-rtm-create.png)

    Figure 3. The arrow shows the **Applications** field in the **Create an Alert** window.

    Name

    Enter a meaningful name for the custom alert.

    Severity level

    Select the severity level to apply to the alert:

    - **Critical**

    - **Warning**

    - **Info**

    Source

    Select **Applications** for the alert source.

    Application type

    Select **CloudHub Applications**.

    Applications

    Select the application that contains the flow that you configured to trigger a custom alert.

    Condition

    Select **Custom application notification**.

    - Select the priority from the **Priority** menu, or leave the priority as **Any** to send
      notifications regardless of priority.

    - In **Contains**, enter the string to use to trigger a notification.

      This string must match a string in the **Message** field that you configured in CloudHub
      Connector.

    Subject

    Enter the subject line to include in the notification email.

    Message

    Enter the custom message to include in the notification.

    Recipients

    Enter the email addresses for notification recipients.

    You can use variables in the alert **Subject** and **Message** fields. For information about
    using variables in alerts, see
    [Alert Variables](https://docs.mulesoft.com/runtime-manager/alerts-on-runtime-manager#alert-variables).

When you trigger the alert, the specified recipients receive an email with the custom message you
added to the app.

## Notifications

_Notifications_ give you visibility into business-related events inside your application. For
example, you can create notifications that appear when:

- Your application is unable to connect to a remote service.

- An error that requires human intervention occurs, such as a problem with data mapping.

- You want to create a summary of what happened in your application, such as the number of orders
  processed.

> [!NOTE] CloudHub stores up to a maximum of 1000 notifications per application. If the number of
> notifications exceeds the maximum, CloudHub deletes the oldest notification. Each notification can
> contain up to 10,000 characters.

### Trigger a Notification

To trigger a notification for an app deployed to CloudHub:

1.  Open the application URL and path, for example:

    `http://myApp.us-w1.cloudhub.io/store`

    The page displays an error message and sends a new notification to the Runtime Manager console.

2.  In the Runtime Manager **Applications** page, click the red bell icon in the upper-right to
    display the notification.

    ![Error in the notifications dropdown](/mulesoft/current/en-us/cloudhub/_images/alerts-custom-rtm-notification-error.png)

    Figure 4. The arrow shows the error in the notifications dropdown.

If the notification is sent after an exception, it includes `exception.message` and
`exception.stacktrace` as custom properties of the notification, accessible from the Runtime Manager
console.

### Send an Error Notification

You can use the CloudHub Connector inside an `<error-handler>` component to send notifications when
errors happen.

For example, use the `<on-error-propagate>` component to send the error message and stop processing
the flow:

```xml
<flow name="myTestFlow" >
...
    <error-handler >
        <on-error-propagate enableNotifications="true" logException="true" doc:name="On Error Propagate" type="ANY">
            <cloudhub:create-notification doc:name="Create Notification" config-ref="CloudHub_Config" domain="bad-app-name" priority="WARN">
                <cloudhub:message ><![CDATA[#[error.description]]]></cloudhub:message>
            </cloudhub:create-notification>
        </on-error-propagate>
    </error-handler>
...
</flow>
```

For information about the On-Error components, see
[Using On-Error Components to Handle Messaging Errors](https://docs.mulesoft.com/mule-runtime/latest/error-handling#on_error_continue).

## See Also

- [Alerts](https://docs.mulesoft.com/runtime-manager/alerts-on-runtime-manager)

- [Add the Connector to Your Mule Project](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio#install)

- [CloudHub Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-cloudhub-connector/)
  on Exchange

- [Create the CloudHub Configuration](https://docs.mulesoft.com/cloudhub-connector/latest/#create-the-cloudhub-configuration)

- [Deploy to CloudHub](https://docs.mulesoft.com/cloudhub/deploying-to-cloudhub)

- [Introduction to Mule 4: Error Handlers](https://docs.mulesoft.com/mule-runtime/latest/mule-error-concept)
