An Azure service that provides an event-driven serverless compute platform.
Hi @john john Pter ,
Thank you for reaching out to Microsoft Q & A !
You can extend your existing Azure Functions solution using Microsoft Graph change notifications. Files uploaded to a Team’s General channel are stored in the associated SharePoint site, so monitor the underlying document library rather than Teams messages. See Teams and SharePoint integration.
Recommended flow
File upload → Graph notification → HTTP-triggered Function → Queue → Worker Function → AI API → Summary saved to SharePoint
1. Identify the General channel folder
Use the Get filesFolder API to obtain the channel folder’s id and parentReference.driveId. Store these identifiers instead of hard-coding paths such as Shared Documents/General.
2. Create a change-notification subscription
For this design, subscribe to /drives/{drive-id}/root with changeType set to updated, then filter processing to the General channel folder.
Point notificationUrl to a publicly accessible HTTPS endpoint hosted by an HTTP-triggered Azure Function.
- During subscription validation, return the URL-decoded
validationTokenastext/plainwith HTTP 200 within 10 seconds. - For regular notifications, validate
clientState, persist the notification to a queue, and return HTTP 202 Accepted promptly. Keep document processing in the worker Function.
See Create a subscription and Receive notifications through webhooks.
3. Identify uploaded files using delta queries
Establish an initial baseline during provisioning, then run a catch-up delta query after creating the subscription.
In the worker Function, call /drives/{drive-id}/root/delta, follow each @odata.nextLink, and save the final @odata.deltaLink. On subsequent notifications, resume from the saved delta link.
Filter the results to new files in the General channel folder, skipping folders, deleted items, previously processed files, and generated summaries.
See Track changes with driveItem delta.
4. Process the document asynchronously
The worker Function should:
- Download the uploaded file from SharePoint.
- Send its content to the external AI summarization endpoint.
- Upload the generated summary to SharePoint.
- Use durable processing state keyed by drive ID and item ID to handle repeated notifications without creating duplicate summaries.
- Explicitly exclude generated summaries from processing to prevent repeated AI calls.
Store AI credentials in Azure Key Vault or secured Function App settings, and grant only the Microsoft Graph permissions required for your design.
5. Renew subscriptions and reconcile changes
Renew the subscription before its expirationDateTime. The documented maximum lifetime for driveItem subscriptions is 42,300 minutes (under 30 days). Periodic delta reconciliation can recover changes missed during notification interruptions.
See the Microsoft Graph subscription reference.
Validation test: Upload a document to General and confirm that one summary is generated, repeated notifications do not create duplicates, generated summaries are skipped, and the saved delta link advances after successful processing.
Please "Upvote the Answer" if this information helped you. This will help us and others in the community as well.