Skip to content

OneDriveWebhook

The OneDriveWebhook component allows you to automatically track changes in your Microsoft OneDrive storage. It acts as a listener that detects when files are added, modified, or deleted and passes this information to your workflow so you can automate responses. This is useful for scenarios like notifying a team when a new document is uploaded, triggering a backup process when files are modified, or logging deletions for security auditing.

How it Works

This component connects to Microsoft OneDrive using the Microsoft Graph API. It works by periodically checking your storage for updates, a process known as polling. When you set up the component, you specify which folder to watch and which types of changes you are interested in.

Once a change is detected, the component gathers details about the file, such as its name, type, and the time of the modification. It then formats this information into structured data that can be used by subsequent steps in your automation. The component operates in near real-time, ensuring you receive notifications quickly after a file changes.

Connection & Credentials

This component requires configuring a credential in the Nappai panel before interacting with the external service:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the type specified for this component and fill in the required fields (API Keys, tokens, etc.).
  3. In your workflow, select the saved credential in the Credential input field of this node.

Note: You need to use a Microsoft One Drive credential. This typically involves providing a Client ID, Client Secret, and Tenant ID from your Microsoft Azure account.

Inputs

Input Fields

  • Watch Folder: Select the OneDrive folder to monitor for changes. If not selected, the entire Drive is monitored.
  • Events: OneDrive change events to listen for. Defaults to all if none selected. You can choose specific events such as:
    • File Added: A new file is created in OneDrive.
    • File Modified: An existing file is updated.
    • File Deleted: A file is removed or trashed.

Outputs

Output Data Example (JSON)json

{ “event”: “file_modified”, “fileId”: “01EXAMPLE123456789”, “fileName”: “Quarterly_Report.xlsx”, “mimeType”: “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”, “modifiedTime”: “2023-10-27T14:30:00Z” } This output provides structured data about the detected file change. You can connect this output to other components to process the file, trigger notifications, analyze content with AI, or store metadata in databases. The data includes the event type, file ID, file name, MIME type, and the time of modification, giving you all the context needed to automate actions based on specific file updates.

Connectivity

Connect the Data output to components that can process file metadata or take action based on file changes. Common connections include:

  • Notification Components: Send emails or messages to alert users about file updates.
  • AI/Analysis Components: Pass file details to AI models for summarization, classification, or content analysis.
  • Storage/Database Components: Log file events for auditing or trigger backups and archiving processes.
  • File Processors: Route files to components that extract text or convert formats.

This component is typically used at the start of a workflow to catch events, followed by logic components that decide how to handle the change.

Usage Example

Imagine you want to automatically notify your team whenever a new report is uploaded to your shared drive.

  1. Add the OneDriveWebhook component to your dashboard.
  2. Select the specific folder containing your reports in the Watch Folder field.
  3. Select File Added in the Events field to focus only on new uploads.
  4. Connect the Data output to an Email or Chat notification component.
  5. Configure the notification message to include the file name from the webhook data.

Now, whenever someone adds a file to that folder, the webhook detects the change and triggers a notification to your team with the details of the new file.

Tips and Best Practices

  • Monitor Specific Folders: Use the Watch Folder field to focus on specific directories. This reduces the load on the webhook and ensures you only receive relevant events. Leave this field empty to monitor the entire OneDrive drive.
  • Filter Events: Use the Events field to filter noise. If you only care about updates, select only File Modified. If you need to track deletions for security, add File Deleted.
  • Real-Time Awareness: The component uses polling, which means there may be a slight delay (usually a few seconds) between a file change and the detection. This is normal and ensures reliable event delivery.
  • Credential Permissions: Ensure your Microsoft Azure credential has the necessary permissions to read file metadata and detect changes in OneDrive. Without proper permissions, the webhook may not trigger correctly.
  • Workflow Design: Since the output provides structured data, design downstream components to expect file metadata. You can use the file ID or name to reference the specific file in subsequent steps.

Security Considerations

  • Secure Credentials: Keep your Microsoft One Drive credentials secure. Never share your Client Secret or Tenant ID with unauthorized users.
  • Least Privilege: When configuring your Azure application, grant only the permissions required for your workflow to adhere to the principle of least privilege.
  • Data Privacy: Be aware that the webhook captures metadata about files. Ensure your automation workflows comply with your organization’s data privacy policies when handling file information.