Microsoft Webhooks: Notification endpoint must respond with 200 OK to validation

Sanket Khot 51 Reputation points
2023-03-20T07:06:07.5466667+00:00

Hi,
I want to subscribe to calendar events and I am using the following API call

User's image

and I am getting the following error

User's image

My code in calendar_notification (notificationUrl) has the functionality to send back 200 OK with validationToken.
But while checking my server logs I realised that this API is not even hitting the notificationUrl.
I have confirmed that notificationUrl is live and responds back if I hit the URL directly on the browser.
Also, My app has the following permissions
User's image

I can call all the other types of APIs like me/calendar, create events or even GET subscriptions but can not use POST API

Can someone tell me what am I missing and why am I getting this error?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,592 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. HarmeetSingh7172 4,811 Reputation points
    2023-03-20T19:54:15.75+00:00

    Hello Sanket Khot,

    Thanks for reaching out!

    The subscription notification endpoint (specified in the notificationUrl property) must be capable of responding to a validation request as described in Notification Endpoint Validation. If validation fails, the request to create the subscription returns a 400 Bad Request error. Ensure that your API accepts "text/plain" as a Content-Type.

    Additionally, you can use the Microsoft Graph Postman collection to confirm that your endpoint properly implements the validation request.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.