> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m3ter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Example - Notification Setup for Commitment Updated Event

This topic provides a worked example of how to use API calls to set up a Notification Rule for triggering a Notification only if the specific conditions defined in the Notification Rule are satisfied:

* Any Commitment updated Event where the Commitment amount drops below 10% of the original amount.

When an Event of this type occurs in the system and which satisfies this condition, a Notification will be sent to the configured Destination.

You can follow the set up in three steps:

* [Step 1: Create a Notification Rule](/guides/alerts-events-and-notifications/utilizing-events-and-notifications/example-1-commitment-updated-event#step-1-create-a-notification-rule)
* [Step 2: Create Integration Destination](/guides/alerts-events-and-notifications/utilizing-events-and-notifications/example-1-commitment-updated-event#step-2-create-integration-destination)
* [Step 3: Create Integration Configuration for Notification](/guides/alerts-events-and-notifications/utilizing-events-and-notifications/example-1-commitment-updated-event#step-3-create-integration-configuration-for-notification)

<Tip>
  **Tip: Setting Up Notifications for Events in Console?** You can also set up Notification Rules that reference a specific system Event and then link these Rules to webhook integration Destinations you've created to complete the Notification configuration. See the [Linking Notification Rules to Destinations](/guides/alerts-events-and-notifications/utilizing-events-and-notifications/creating-managing-and-reviewing-notifications#linking-notification-rules-to-destinations-to-create-notification-integration-configurations) section in the [Creating, Managing, and Reviewing Notifications](/guides/alerts-events-and-notifications/utilizing-events-and-notifications/creating-managing-and-reviewing-notifications) topic.
</Tip>

## Step 1: Create a Notification Rule

`POST at https://api.m3ter.com/organizations/{orgId}/notifications/configurations/`

In this example, we’ve set up a rule for triggering a Notification based on a `configuration.commitment.updated` Event, which includes a calculation referencing Event Fields to define the precise conditions for triggering the Notification. The calculation means the Notification will be triggered when the amount spent from the commitment drops below 10% of the total amount.

```json theme={null}
{
   "name": "Commitment has under 10% remaining",
   "description": "Commitment amount fell below 10%",
   "eventName": "configuration.commitment.updated",
   "calculation": "(new.amountSpent >= ((new.amount*90)/100)) 
   AND ((old.amountSpent <= ((old.amount*90)/100)) OR (old.amountSpent == null))",
   "code" : "under_10_percent_",
   "active": true
}
```

<Tip>
  **Note:** The response schema for this call returns a unique “id” for the notification rule we’ve set up
</Tip>

## Step 2: Create Integration Destination

`POST at: https://api.m3ter.com/organizations/{orgId}/integrationdestinations/webhooks`

```json theme={null}
{
   "url":"https://xbmnbkwece.execute-api.eu-west-2.amazonaws.com/dev/send_email"
   "version": 1,
   "credentials": {
      "version": 1,
      "type": "M3TER_SIGNED_REQUEST",
      "apiKey": "apiKey",
      "secret": "some secret"
   }
}
```

With this call, credentials are done in the same call as the Destination. In the response schema, the unique “id” for Integration Destination is returned.

## Step 3: Create Integration Configuration for Notification

`POST at: https://api.m3ter.com/organizations/{orgId}/integrationconfigs`

```json theme={null}
{
   "entityType": "Notification",
   "entityId": "id of the notification rule",
   "destination": "Webhook",
   "destinationId": "id of the destination",
   "configData": {},
   "credentials": {
      "type" : "M3TER_SIGNED_REQUEST"
    }
}
```

For this call:

* We use the `“id”` of the Notification Rule returned for the `POST` call we sent in [Step 1](/guides/alerts-events-and-notifications/utilizing-events-and-notifications/example-1-commitment-updated-event#step-1-create-a-notification-configuration) as the value for the `“entityId”`.
* We use the Integration Destination `“id”` returned for the `POST` call at [Step 2](/guides/alerts-events-and-notifications/utilizing-events-and-notifications/example-1-commitment-updated-event#step-2-create-integration-destination) as the value for the `“destinationId”`.
