Is it possible to create webhooks with a personal account to listen to changes in an Excel file using Microsoft Graph?

Oscar González 0 Reputation points

I want to create a webhook to listen for changes in excel files. This is the code I have:

     "changeType": "updated",
     "clientState": "microsoft_graph"

The problem is that I am getting the following error:

"message": "Subscription validation request failed. Response must exactly match validationToken query parameter.",

The code for the notificationUrl page is as follows:

// Check if the request is a validation request (GET)
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['validationToken'])) {
     // The validation request must respond with the validation token
     $validationToken = $_GET['validationToken'];
     $validationToken = urldecode($validationToken);
     // Set the content type to text/plain
     header('Content-Type: text/plain');
     // Returns the validation token
     echo $validationToken;
} else if ($_SERVER['REQUEST_METHOD'] === 'POST') {
     // Process the actual change notification (if necessary)
     // Your logic for handling the change notification goes here
     echo 'Notification received successfully.';
} else {
     // If the request is neither GET nor POST, respond with a 405 status code (Method not allowed)

I wonder if this error is shown because I use a token from a personal Microsoft account or because it occurs?

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
3,759 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,557 questions
0 comments No comments
{count} votes