Subscription Filters

An Event Notification Service (ENS) subscription can filter the notifications that it sends to the associated callback. Express filters as a list of one or more name-value pairs.

For ENS to deliver the notification to the callback, all the name-value pairs in the filter must be true.

These data items are available for subscription filtering for each transactional send event type.

Notification Event CategoryNotification Event TypeData Items Available for Filtering
TransactionalSendEventsEmailSent, SMSSentdefinitionKey
TransactionalSendEventsEmailNotSent, SMSNotSentdefinitionKey, statusCode
TransactionalSendEventsEmailBounceddefinitionKey, bounceCode, smtpReason
SendEventsAutomationInstanceStartedautomationName, automationCustomerKey, automationType
SendEventsAutomationInstanceCompletedautomationName, automationCustomerKey, automationType
SendEventsAutomationInstanceStoppedautomationName, automationCustomerKey, automationType
SendEventsAutomationInstanceErroredautomationName, automationCustomerKey, automationType
SendEventsAutomationInstanceSkippedautomationName, automationCustomerKey, automationType
SendEventsPushSent, PushNotSent, PushBouncedsendMethod
EngagementEventsPushOpen, OttSent, OttDelivered, OttRead, OttFailed, OttMobileOriginated, PushDeliveryReceipt, PushImageClick, PushButtonClicksendMethod

For example, to filter TransactionalSendEvents.EmailSent events for a specific transactional send definition, include this subscription filter in the subscription.

If you apply this filter to a subscription for TransactionalSendEvents.EmailSent events, the callback receives TransactionalSendEvents.EmailSent notification events only for the transactional send definition of 12345. ENS filters all other TransactionalSendEvents.EmailSent notification events.

ENS supports pattern matching using regular expressions (regex). ENS uses the RE2 regex engine, which offers high performance, enhanced security, and efficient handling of large inputs. However, it doesn’t support some advanced regex features, such as:

  • Backreferences
  • Look-ahead and look-behind assertions
  • Conditional expressions
  • Recursion
  • Balancing groups

For a complete list of regex functions that RE2 supports, see Github: RE2 Syntax.

To prevent long-running expressions from impacting performance, ENS enforces a timeout on filters. If a filter that includes regex times out, the system processes the filter without the regex. Additionally, if a filter contains invalid regex, the system drops the event. For these reasons, we recommend that you test regex filters before you use them in production use cases.