My notification url has dev.xyz.uno is the domain name
Because still getting 400 error for validationError
Please check the code for any errors
//code for subscription
$expirationDateTime = Carbon::now()->addMinutes(4230)->toIso8601String();
$notificationUrl='https://dev.xyz.uno/en/outlook-calendar/webhooks';
$client = new \GuzzleHttp\Client();
$response = $client->post('https://graph.microsoft.com/v1.0/subscriptions', [
'headers' => [
'Authorization' => 'Bearer ' . $accessToken,
'Content-Type' => 'application/json',
],
'json' => [
'changeType' => 'created,updated,deleted',
'notificationUrl' => $notificationUrl,
'resource' => '/me/events',
'expirationDateTime' => $expirationDateTime,
'clientState' => 'test1234',
],
]);
if ($response->getStatusCode() === 201) {
$subscription = json_decode($response->getBody()->getContents(), true);
print_r($subscription);
}
//code to recieve notifications having route as
https://dev.xyz.uno/en/outlook-calendar/webhooks
public function handleNotification(Request $request)
{
$validationToken = $request->header('validationToken');
if ($validationToken) {
return response($validationToken, 200)
->header('Content-Type', 'text/plain; charset=utf-8');
}
}