Subscription validation request failed. Notification endpoint must respond with 200 OK to validation request

Danilo Toro 0 Reputation points
2024-04-04T20:44:28.77+00:00

I am trying to call https://graph.microsoft.com/v1.0/subscriptions from my laravel code. I am getting this error message "Subscription validation request failed. Notification endpoint must respond with 200 OK to validation request".

while calling the api in notification url I have provided a POST route which returns validation token as plain text. It returns 200 ok response code.
I tested my route from postman
WhatsApp Image 2024-04-04 at 8.40.52 AM

still this subscription api is giving me the above error. I have tried almost everything.
double verified everything i found online. can someone suggest a solution or find any issue ?
here is my code snippet for subscription api
User's image

Microsoft Teams | Development
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deepanshu Sharma 500 Reputation points Microsoft External Staff
    2024-04-07T20:36:03.4366667+00:00

    Hello Danilo Toro,

    Few things to check here -

    1. Try isolating the code and use Postman/Graph Explorer to call same API and observe results.
    2. Try Checking if you are getting the request on the notificationUrl.
    3. Do note notificationUrl must be capable of responding to the validation request.
    4. Also, you need to make sure that the validation token returns as plain/text. Please refer to the Notification endpoint validation document for details.
    5. Response within 10 seconds 200 (OK) status code. content type must be text/plain. body must include the validation token.

Your answer

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