Skip to main content

⚑ Automations

Docflo.ai enables powerful automations to streamline document workflows, integrate with external systems, and manage secrets and dependencies securely.

✨ Key Features:
  • Automate document processing, validation, and routing
  • Trigger actions based on document events or data
  • Integrate with external APIs and services
  • Secure secret management for credentials and tokens
  • Support for custom dependencies and injected objects

πŸš€ How it works​

  1. Go to the Automations section in the Docflo.ai platform.
  2. Create or edit an automation by defining triggers, actions, and conditions.
  3. Configure integrations with external APIs or services as needed.
  4. Manage secrets securely within the platform for use in automations.
  5. Test and activate your automation to streamline your workflow.

Automations in Docflo.ai help you eliminate manual steps, reduce errors, and ensure your document processes are efficient and reliable.

πŸ“‹ Templates​

Get started quickly by using pre-built automation templates. Click the three-dot menu and select "Select a template" to import existing working automations:

  • Email Notification - Send automated email notifications based on document events
  • Data Extraction - Extract and process data from documents automatically
  • Webhook Integration - Connect with external systems via webhooks
  • SAP SuccessFactors - Integrate with SAP SuccessFactors for HR document workflows
  • Monday - Sync documents with Monday.com project management
  • Microsoft Dynamics - Connect with Microsoft Dynamics for business process automation
  • SAP S/4HANA Cloud - Integrate with SAP S/4HANA Cloud for enterprise workflows
  • Priority ERP - Integrate with Priority ERP for enterprise workflows

πŸ“¦ Dependencies​

If you need to use npm packages in your automations, such as axios for server-side HTTP requests, add them under the "Dependencies" section. This ensures all required packages are available during automation execution.

Example dependencies:

  • axios - For HTTP requests to external APIs
  • lodash - For data manipulation utilities
  • moment - For date and time handling

Manager Tools / Docflo SDK​

Following built-in methods are available wihin the manager SDK that allow you performing different platform actions, such as downloading binary file itslef, updating fields and fetching additional documents. Here are the available methods (all async):

  • manager.updateDocument(docData) - Updating document field values. Be careful in async executions, it overrides all document fields (including status, for instance)
  • manager.updateStatus(statusId) - updates document status, see Statuses that can be passed to this call
  • manager.refreshApproval() - recalculates approval workflow. You can call it in case you updated fields that affect approvals and you want to re-route the document from scratch
  • manager.getDocuments(query) - Allows fetching other documents (for different comparison use cases / duplicate lookups)
  • manager.patchModelFields(documentId, modelFields) - For updating of other document fields
  • manager.downloadDocument('originam' | 'signed') - downloads the binary content of the current document. In case of 'signed' it downloads the version that includes document log from the platform printed in the footer.
  • manager.getEmailAttachments() - returns an array of all attachments that were extracted from origin email
  • manager.getDatasets() - returns a list of available datasets
  • manager.getDatasetItems(datasetId, skip?, limit?) - returns dataset items you can iterate over
  • manager.getCredential(credentialsId) - returns credentials buy ID, which can be copied from "Security" area

Usage example - Updating documnent fields:

try {
// Take the entire docflo_results and only update specific fields
const updatedDocfloResults = {
...doc.docflo_results,
modelFields: {
...doc.docflo_results.modelFields,
SomeFieldToUpdate: {
value: "New Value",
type: "string",
confidence: 1,
content: "New Value",
},
},
};

doc.docflo_results = updatedDocfloResults;
await manager.updateDocument(doc);
return true;
} catch (updateError) {
console.log(`UPDATE FAILED: ${updateError instanceof Error ? updateError.message : String(updateError)}`,)
return false;
}

πŸ” Secrets​

Store sensitive information securely using the Secrets section. This is ideal for:

  • Server addresses and endpoints
  • API keys and tokens
  • Usernames and passwords
  • Database connection strings

Usage in code:

// Access secret values using ${secret.KEY} syntax
const apiKey = secrets.API_KEY;
const serverUrl = secrets.SERVER_URL;
const username = secrets.DB_USERNAME;

πŸ§ͺ Testing​

Test your automations before deploying them using the "Testing" section:

  1. Navigate to the Testing section of your automation
  2. Provide a document ID to test with
  3. View immediate execution results in the debugging console
  4. Review logs, outputs, and any errors
  5. Iterate and refine your automation logic

The debugging console provides real-time feedback on your automation's performance and helps identify issues before activation.

πŸ’‘ Tip: Please refer to Data Types for supported data structures and field types you can use within your automation.

For documentation on injected objects and advanced automation scenarios, consult your platform administrator or contact the Docflo.ai support team.