GraphNotificationHandler is a shared singleton HTTP handler for incoming Microsoft Graph change notifications. It is registered at the /4dnk-graph-notification route and handles both validation requests and notification payloads, routing them to the appropriate active GraphNotification monitors.
To use push mode with the host web server, add the following entry to Project/Sources/HTTPHandlers.json:
[
{
"class": "NetKit.GraphNotificationHandler",
"method": "getResponse",
"regexPattern": "/4dnk-graph-notification",
"verbs": "post"
}
]
Notes:
- The 4D Web Server must be launched in TLS 1.2 to comply with the Microsoft Graph server requirements.
- If the OAuth 2.0 connection uses an HTTPS redirect URI, the port in the
endPointmust match exactly.- If both a
calendar.notifierand amail.notifierare declared, they must use the same port.
.getResponse( request : 4D.IncomingMessage ) : 4D.OutgoingMessage
| Parameter | Type | Description | |
|---|---|---|---|
| request | 4D.IncomingMessage | -> | Incoming HTTP request from Microsoft Graph. |
| Result | 4D.OutgoingMessage | <- | HTTP 200 + validationToken for validation requests; HTTP 202 for notification payloads; HTTP 400 when request is Null. |
.getResponse() handles two types of incoming requests from Microsoft Graph:
POST ?validationToken=<token>: Microsoft sends this to verify the endpoint. The response must echo the token as plain text with status 200.POST with JSON body containing {value: [...]} array: routes each item to the matching GraphNotification monitor via Storage.graphNotifications.