Cookies

This website uses cookies to ensure you get the best experience on our website.

Guide: Understanding Hooks & Actions

Hooks and Actions automate tasks and connect different parts of your system together.
They allow your website or modules to react automatically to specific events, incoming data, or time-based schedules.

This guide will help you understand how hooks and actions work, what trigger types exist, and how to configure conditions, cases, and schedules.


1. What Are Hooks & Actions?

  • A Hook is an event listener — it watches for something to happen.
  • An Action is the response — it defines what should happen when that event occurs.

For example:

“When a new order is created (hook), send an email to the customer (action).”

Hooks connect your system’s behavior to specific triggers without needing manual input.


2. Hook Trigger Types

Hooks can start from one of three trigger types:

  1. Module Lifecycle
    Triggered automatically when a specific module event occurs.

    Common lifecycle events:

    • When a record is created
    • When a record is updated
    • When a record is deleted

    Use Case Example:

    • Trigger: On Order module → record created
    • Action: Send “Order Received” email to customer.

  2. Inbound Hook
    Triggered when your system receives a request through an Inbound Route (similar to a webhook).

    Typical usage:

    • Integrating with external apps that send data to your system
    • Handling POST or GET requests from outside services

    Use Case Example:

    Trigger: Inbound Hook → /api/webhook/payment
    Action: Update payment status in Orders module


  3. Schedule
    Triggered automatically based on time intervals or cron-like schedules.

    You can schedule hooks to run:

    • Every hour
    • Daily
    • Weekly
    • Monthly
    • Or at custom intervals

    Use Case Example:

    Trigger: Schedule → Every night at 2 AM
    Action: Clean temporary records or send summary reports.


3. Hook Components Overview

Every hook can include several key components that control how and when it runs.

  1. Module
    Defines which module or dataset the hook is associated with.
    Only relevant for Module Lifecycle and Module-related Actions.

    Example:
    Hook watches the Orders module — when a new order is created, trigger associated actions.


  2. Hook Conditions
    Conditions allow you to filter when a hook should execute.
    They work like smart filters applied to route or module data.

    Examples:

    • Only trigger when Order Status = “Delivered”
    • Only trigger when Customer Type = “Premium”
    • Only run if Amount > 1000

    Conditions make your automation precise and prevent unnecessary actions.


  3. Actions
    Actions define what happens when the hook is triggered.
    You can add multiple actions under one hook.

    Common action types:

    • Send Email or Notification
    • Create or Update a Record
    • Call an External API
    • Change Module Data
    • Trigger another Hook or Workflow

  4. Action Cases
    Each Action can include multiple cases — logical branches that decide how the action runs.

    Example:

    • Action: “Send Email”
      • Case 1 → If Order Amount > 5000, send “VIP Thank You” email.
      • Case 2 → Else, send regular “Order Confirmation” email.

    This allows a single hook to handle multiple outcomes based on logic.


  5. Schedule Card
    For Schedule triggers, you’ll configure a Schedule Card to define timing.

    Options typically include:

    • Recurring Type / Once
    • Start time and TimeZone
    • Specific weekdays
    • Specific times
    • Max runs

    The system runs the defined actions automatically at the scheduled time.


4. How to Create a Hook (Step-by-Step)

  1. Go to the Hooks & Actions section in your admin panel.
  2. Click Add New Hook.
  3. Enter a Hook Name and Description.
  4. Choose a Trigger Type:
    • Module Lifecycle
    • Inbound Hook
    • Schedule
  5. If applicable, select a Module and Lifecycle Event.
  6. Configure Hook Conditions (optional filters).
  7. Add one or more Actions under the hook.
  8. Inside each action, define Action Cases for specific logic.
  9. If using Schedule type, set up the Schedule Card (time or frequency).
  10. Save and Activate the hook.

5. Managing Hooks & Actions

  • Edit: Modify trigger type, module, or actions anytime.
  • Activate / Deactivate: Control whether the hook is currently active.

6. Best Practices

Use descriptive names for hooks and actions (e.g., “Notify Customer on Order Shipped”).
Group related actions under a single hook for clarity.
Always test your hook after creation to verify expected results.
Add conditions carefully to avoid triggering unwanted actions.
Review schedules regularly to prevent redundant tasks.


7. Example Workflows

  1. Order Confirmation (Module Lifecycle)

    • Trigger Type: Module Lifecycle
    • Module: Orders
    • Event: On Create
    • Action: Send Email
    • Case: Send order confirmation email to customer.

  2. Payment Update (Inbound Hook)

    • Trigger Type: Inbound Hook
    • Route: /api/webhook/payment
    • Action: Update Order module’s payment status.

  3. Auto-Report (Schedule)

    • Trigger Type: Schedule
    • Schedule: Every Day at 6 AM
    • Action: Generate and email daily sales report.

Next Steps:
Explore how Module Lifecycle, Inbound Routes, and Scheduled Hooks can be combined to build powerful automation workflows across your entire system.