Webhook for the Teams Presence API

Darren Fuller 0 Reputation points
2025-03-26T06:03:45.03+00:00

I'm trying to set up a webhook for the Teams Presence API. My webhook URL is publicly accessible and responds with a 200 status code and the validation token, but I'm still receiving a ValidationError: Subscription validation request failed.

I'm using this url - https://graph.microsoft.com/v1.0/subscriptions

This is the payload i'm using to subscribe presense webhook.

{
  "changeType": "created,updated",
  "notificationUrl": "https://xyz.com/teams-presence-webhook",
  "lifecycleNotificationUrl": "https://xyz.com/teams-presence-webhook",
  "resource": "communications/presences/id",
  "expirationDateTime": "2025-03-26T14:40:00.0000000",
  "clientState": "mySecureRandomString12345"
}


This is the response i'm getting.

{
  "error": {
    "code": "ValidationError",
    "message": "\nValidation: Testing client application reachability for subscription Request-Id: *****",
    "innerError": {
      "date": "2025-03-17T13:40:28",
      "request-id": "****",
      "client-request-id": "****"
    }
  }
}


Here is the Laravel code handling the response:

if ($request->has('validationToken')) {
    return response($request->query('validationToken'), 200)
        ->header('Content-Type', 'text/plain');
}


My webhook endpoint is responding within 10 seconds.

I tested it using Postman and cURL, and the webhook endpoint is responding correctly.

Please see postman request screenshots.

User's image

User's image

I've confirmed this steps as well. But didn't help me.

  • Ensure that your webhook endpoint responds with the validation token in plain text format (text/plain) within 10 seconds of receiving the validation request. This is crucial for the subscription validation process.
  • Verify that the content-Type header in your response is set to text/plain. If its something else, the validation will fail.
  • Use tools like postman or curl to simulate the validation request and ensure your endpoint responds correctly.
  • Confirm that there are no firewall or network restrictions blocking the validation request from Microsoft Graph.

The problem is still there. It would be grateful if someone can help.

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

1 answer

Sort by: Most helpful
  1. Saranya Madhu-MSFT 2,295 Reputation points Microsoft External Staff
    2025-03-26T08:47:45.43+00:00

    Hi Darren Fuller,

    Thanks for reaching out to Microsoft!

    As per the documentation here: Subscriptions on presence require any resource data included in a change notification to be encrypted. Always specify the encryptionCertificate parameter when creating a subscription to avoid failure. See more information about setting up change notifications to include resource data.

    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.


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.