You can trigger a Torq workflow when a file is updated in a Microsoft OneDrive folder.
In the following example, the workflow uses delta queries in Microsoft Graph to retrieve details about changes to the driveItem resource. The Drive Delta Latest Token step queries the API endpoint for the driveItem resource: https://graph.microsoft.com/v1.0{{ $.event.value.0.resource }}/delta(token='latest'). A global variable is created from the output of that step, which is then returned by the Get Latest Changes in drive hierarchy step to obtain the URL for the specific API endpoint.
When multiple files are uploaded at once, a single notification will be sent and the files will be listed in the output of the Get Latest Changes in drive hierarchy step. The output will always include a change notification for the root folder, as well as any additional folder in the OneDrive path where files were updated.
Prerequisites
Before you begin:
Create a Torq step integration that stores your API key's client ID and client secret.
Create a Microsoft 365 step integration in Torq.
Create a Microsoft 365 Graph Subscription trigger integration in Torq and copy the webhook URL.
Create a subscription to Microsoft Graph API change notifications for the driveItem resource
Import the Microsoft Graph Subscription workflow: Import the Create Microsoft Graph Subscription and Renew Daily workflow template to your workspace.
Configure the workflow parameters: Once the workflow opens, click the Workflow Parameters step.
For torq_graph_microsoft365_webhook, paste the webhook URL you copied earlier when creating the Microsoft 365 Graph Subscription trigger integration.
For microsoft365_integration, select the Microsoft 365 step integration instance you created earlier.
For resource_to_monitor, enter
/drives/<drive id>/root.You can obtain the drive ID by using Microsoft OneDrive steps such as List Items and List User or Group Drives.
For Torq Integration, select the relevant Torq step integration instance.
(Optional) Modify Torq Global Variable Name according to your organization's needs or customs. It will store the details of your subscription to the driveItem change notifications.
Edit both Create Graph Subscription to Change Notifications steps: For the Change type parameter, select updated to receive notifications for any updates to the driveItem resource.
Microsoft Graph API only allows you to subscribe to driveItem changes at the root level. Subscriptions to changes for specific folders within a drive are not currently supported.
Create a workflow triggered by Microsoft 365 Graph API change notifications for the driveItem resource
Change notifications for the driveItem resource in Microsoft Graph can take several minutes to get delivered to the remote endpoint, i.e. the Torq trigger integration.
Microsoft Graph's change notifications only provide information about the nature of the change ("changeType": "updated") and the affected resource at /drives/<drive id>/root but won't provide further details about the specific change to the resource. Retrieving those details requires querying the appropriate endpoint from the Microsoft Graph API.
Download the workflow: Download the Microsoft OneDrive change notifications workflow below.
Import the workflow: Navigate to Build > Workflows, click Import workflow, and select the workflow from your device.
Configure the trigger: Open the trigger, click Create Trigger > Microsoft 365 Graph Subscription, and then select the integration instance you created earlier.
Review and run the workflow: Review the workflow's steps and their parameters, and then run the workflow.

