Directus Flows Automation Setup

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1262
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1171
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    874
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1094
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    831
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    851

Setting Up Flows (Automation) in Directus

Flows are a visual automation builder in Directus. Logic: trigger (event) → chain of operations. Without coding, you can set up notifications, data synchronization, API calls, email sending.

Flow Triggers

  • Event Hook — collection event (create, update, delete)
  • Schedule — by schedule (cron)
  • Webhook — incoming HTTP request
  • Manual — manual run from admin UI
  • Another Flow — call from another Flow

Example: Notification on New Order

Trigger: Event Hook → items.create → collection orders

Operations:

  1. Read Data — get order details with populate

    { "collection": "orders", "key": "{{$trigger.key}}", "query": { "fields": ["*", "customer.*"] } }
    
  2. Condition — check that order is expensive

    { "rule": { "total": { "_gte": 10000 } } }
    
  3. Send Email (via Operations → Email)

    To: [email protected]
    Subject: Large order #{{$last.id}} for {{$last.total}} $
    Body: Customer: {{$last.customer.email}}
    
  4. Webhook → POST to Slack

    {
      "url": "{{SLACK_WEBHOOK}}",
      "method": "POST",
      "body": { "text": "New order #{{$last.id}} from {{$last.customer.email}}" }
    }
    

Example: Daily Report (Schedule)

Trigger: Schedule → 0 9 * * 1-5 (at 9:00 AM, Mon-Fri)

Operations:

  1. Read Data — last 24 hours of orders

    {
      "collection": "orders",
      "query": {
        "filter": {
          "date_created": { "_gte": "$NOW(-24h)" },
          "status": { "_in": ["paid", "delivered"] }
        }
      }
    }
    
  2. Transform (JS code)

    const orders = $last
    const total = orders.reduce((sum, o) => sum + o.total, 0)
    return { count: orders.length, revenue: total }
    
  3. Webhook → Slack with summary

Example: Incoming Webhook (Stripe)

Trigger: Webhook → POST method

Operations:

  1. Condition — check event type

    { "rule": { "type": { "_eq": "checkout.session.completed" } } }
    
  2. Read Data — find order by ID from metadata

    {
      "collection": "orders",
      "query": { "filter": { "stripe_session_id": { "_eq": "{{$trigger.body.data.object.id}}" } } }
    }
    
  3. Update Data — update order status

    {
      "collection": "orders",
      "key": "{{$last[0].id}}",
      "payload": { "status": "paid" }
    }
    

Custom Operation Extension

For operations not in the standard set:

// extensions/operations/send-sms/index.ts
export default {
  id: 'operation-send-sms',
  handler: async ({ phone, message }: { phone: string; message: string }) => {
    const response = await fetch('https://api.sms.ru/sms/send', {
      method: 'POST',
      body: new URLSearchParams({
        api_id: process.env.SMSRU_API_ID!,
        to: phone,
        msg: message,
      }),
    })
    return response.json()
  },
}

Environment Variables in Flows

In Directus settings (Settings → Project Settings → Flows Variables) you can set variables available to all Flows:

SLACK_WEBHOOK = https://hooks.slack.com/...
CRM_API_URL = https://api.crm.com

In operation reference as {{SLACK_WEBHOOK}}.

Debugging Flows

Directus saves execution logs for each Flow — in admin you can see each step with input/output data and errors. "Test" button allows manual run with mock data.

Timeline

Setting up 3–5 Flows (notifications, webhooks, reports) — 1–2 days without coding.