# Create Alert on Any New Messages in a Topic

**URL:** <https://ask.lenses.io/t/create-alert-on-any-new-messages-in-a-topic/69>\
**Category:** Lenses\
**Created:** [May 24, 2023, 2:51pm UTC](https://ask.lenses.io/t/create-alert-on-any-new-messages-in-a-topic/69 "2023-05-24T14:51:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ACNoonan](https://dub1.discourse-cdn.com/flex017/user_avatar/ask.lenses.io/acnoonan/32/53_2.png) [@ACNoonan](https://ask.lenses.io/u/ACNoonan)\
**Post date:** [May 24, 2023, 2:51pm UTC](https://ask.lenses.io/t/create-alert-on-any-new-messages-in-a-topic/69/1 "2023-05-24T14:51:35Z")

</div>

We would like to alert on any new messages being produced into a specific topic.

The logic for this rule requires setting an Alert for any number of messages being produced to the topic to be greater than ‘0’, but Lenses UI prohibits setting the trigger as less than ‘1’. This is a problem because this only triggers an alert if there are 2 messages produced within the configured timeframe and will be silent if a single message is produced.

How can we make this alert on even a single message produced to a specific topic?

---

<div class="post-metadata">

**Author:** ![ACNoonan](https://dub1.discourse-cdn.com/flex017/user_avatar/ask.lenses.io/acnoonan/32/53_2.png) [@ACNoonan](https://ask.lenses.io/u/ACNoonan)\
**Post date:** [May 24, 2023, 2:56pm UTC](https://ask.lenses.io/t/create-alert-on-any-new-messages-in-a-topic/69/2 "2023-05-24T14:56:13Z")

</div>

This is on our Product teams radar and as noted, is not possible in the UI.

It is possible to configure this Alert with Lenses API or lenses-cli. Here’s an example of how this can currently be implemented:

1. Create the alert (within the limitation of the new-message number) in the Lenses UI
2. Run `lenses-cli export alert-settings`, by default, it will create a directory named `alert-settings` and export all alert conditions there.
3. Edit `alert-settings/alert-settings-producer.yaml`. Change the number of messages to `0` for the desired alert. You can choose to keep as-is or remove the rest of the alerts. The `import` function currently only adds new alerts; it does not remove or alter existing ones.
4. Run `lenses-cli import alert-settings`
5. In the web interface, you will notice that a new _Data Produced_ alert was created with the desired settings. You can delete the old instance of the alert.

Cheers!
