Share via

Server-side filtering options for Microsoft Graph webhook notifications

Surekha Yeddula 60 Reputation points
2026-06-02T03:42:00.64+00:00

Hi Team,

I am using Microsoft Graph webhook subscriptions to receive Outlook mail change notifications. Currently, I understand that subscriptions can be created on resources such as /users/{id}/messages or specific mail folders, but I have not found a way to filter notifications based on message properties.

Is there any server-side filtering capability available that would allow notifications to be generated only for emails matching specific criteria, such as:

  • A particular sender email address
  • Specific recipients
  • Subject keywords
  • Message categories
  • Custom message properties or extended attributes

My goal is to reduce the number of notifications delivered to the webhook endpoint and receive only notifications relevant to a specific business use case.

If such filtering is not currently supported, is the recommended approach to subscribe to the broader resource and perform all filtering within the webhook processing logic after receiving the notification?

Any guidance or recommended alternatives would be appreciated.

Thank you.

Microsoft 365 and Office | Development | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Hani-Ng 11,740 Reputation points Microsoft External Staff Moderator
    2026-06-02T05:12:50.8166667+00:00

    Hi Surekha Yeddula

    Based on my research and understanding, I would like to share some information that I hope it will be help:

    Server-Side Filtering on Message Properties (Current Status)

    You are correct that some filtering is possible, it may be restricted. Microsoft Graph provides limited support for the $filter query parameter in the resource URL when creating a subscription for Outlook messages. However, this support is restricted to a very small number of specific properties (such as isRead) and does not cover the common business-filtering scenarios you've described.

    Specifically, there is no documented support for server-side subscription filtering based on:

    • Sender email address (from)
    • Specific recipients (toRecipients)
    • Subject keywords
    • Message categories
    • Custom or extended properties

    Therefore, while the mechanism exists in a limited form, it is not a viable solution for the requirements you've listed.

    Optimized Client-Side Filtering

    Here is the recommended workflow for a highly performant solution you can try:

    1/ Subscribe to the Narrowest Possible Resource.

    While you can't filter on most properties, you can filter by folder. If your use case is limited to the Inbox, subscribe there. This is the most effective server-side reduction you can perform. "resource": "/users/{user-id}/mailFolders('Inbox')/messages"

    2/ Process the Notification:

    • Standard Notifications (Default): The payload you receive is very lightweight and contains only the ID of the changed resource, not the message data itself. This design requires your application to make a follow-up GET call to fetch the message details.
    • Rich Notifications (includeResourceData: true): If you use this option, the notification payload will include the resource data. This avoids the second GET call but results in larger notification payloads.
    • Fetch only the Properties You Need (for Standard Notifications). This is the most critical optimization. When you make the follow-up GET call for the message, use the $select OData query parameter to retrieve only the properties required for your filtering logic. This drastically reduces payload size and API latency. Example: If you only need to filter by sender and subject, your GET request should be:
    GET https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}?$select=from,subject
    
    

    3/ Apply Your Business Logic.

    In your code, inspect the properties you retrieved. If they match your criteria, proceed with your business process. If not, discard the event.

    To summarize, comprehensive server-side filtering for Outlook mail webhook notifications is not broadly supported. While very limited support exists for specific properties, it does not cover the common business scenarios of filtering by sender, subject, or categories.

    The standard and recommended architecture is to implement the filtering logic on the receiving side (your webhook endpoint), using folder subscriptions and the $select parameter to keep the process as efficient as possible.

    The Microsoft Graph team is aware this is a highly requested feature. I recommend you add your voice and vote for it on the Microsoft Graph Feedback Portal, as customer feedback directly influences our roadmap.

    I hope this helps. If you have any question, please feel free to ask via comment section!

    (Please understand that we're not Microsoft support, this is a user-to-user support forum. Moderators have no backend access and cannot directly intervene in Microsoft products. We provide only technical guidance and best-practice recommendations based on reported issues)


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  2. AI answer

    2026-06-02T03:42:16.3566667+00:00

    Server-side filtering for Microsoft Graph Outlook change notifications is supported in a limited way via the $filter query parameter on the resource when creating the subscription, but not for all the criteria listed.

    For Outlook resources (messages, events, contacts):

    1. Subscriptions must target supported resource paths such as:
      • /users/{id}/messages
      • /me/messages
      • /users/{id}/mailFolders/{id}/messages
    2. To include resource data in the notification payload, the subscription must specify:
      • includeResourceData: true
      • resource: the resource URL including $select for the properties to return
      • encryptionCertificate and encryptionCertificateId
      When specifying resource, $select must be used to explicitly list the Outlook message properties to include. $filter can be added to refine which changes generate notifications.
    3. $filter can be used to refine conditions for notifications. The documentation provides an example for messages based on the isRead property to get only unread messages in a folder. In that example:
      • A message added or marked unread triggers Created.
      • Reading or marking as read triggers Deleted.
      • Other property changes trigger Updated.
      This shows that server-side filtering is supported for some message properties via $filter, but the context only documents isRead explicitly. The context does not document filters for sender, recipients, subject keywords, categories, or custom/extended properties for Outlook message subscriptions.
    4. For other resources (for example, Microsoft Entra Health monitoring alerts), the same pattern applies: $filter can be used in notificationQueryOptions to narrow notifications (for example, alertType), but this is specific to that resource type.

    Based on the provided information:

    • Server-side filtering for Outlook message change notifications is supported via $filter, but the documented example is limited to the isRead property.
    • The context does not document server-side filtering by sender, recipients, subject keywords, categories, or custom/extended properties for Outlook messages.
    • When such filters are not available or documented, the recommended approach is to subscribe to the broader resource (for example, a folder or mailbox) and perform business-specific filtering in the webhook processing logic after receiving notifications.

    In practice, this means:

    • Use $filter where supported and documented (for example, unread messages via isRead eq false) to reduce volume.
    • Use $select to limit the properties included in rich notifications.
    • Implement additional filtering for sender, recipients, subject, categories, or custom properties in the webhook endpoint code after decrypting and reading the resource data.

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.