Skip to main content
Hiro CRM includes powerful automation workflows designed specifically for luxury hospitality. This guide explains how to set up and manage automated customer engagement workflows.

Understanding Automation in Hiro

Hiro’s automation system is built around two core concepts:
  1. RFM-Based Workflows: Automatically engage customers based on their Recency, Frequency, and Monetary value
  2. Behavioral Workflows: Trigger actions based on customer behavior (birthdays, reservations, feedback)
All workflows are pre-configured and optimized for hospitality. Simply enable the ones you need.

Automation Architecture

Hiro uses two automation engines:

1. RFM Automation Engine

Pre-built workflows for customer lifecycle management:
export interface AutomationWorkflow {
  id: string;
  name: string;
  description: string;
  trigger_type: string;           // 'rfm_segment', 'birthday', etc.
  trigger_condition: string;      // 'equals', '>=', 'in_days'
  trigger_value: string;          // Segment ID or condition value
  trigger_config: Record<string, any>;
  action_type: string;            // 'create_campaign_with_template'
  action_payload: Record<string, any>;
  action_config: Record<string, any>;
  category: 'rfm' | 'behavioral' | 'temporal' | 'engagement';
  priority: 'high' | 'medium' | 'low';
  is_premium: boolean;
}
From frontend/lib/automations/rfm-workflows.ts:9-23

2. Inngest Background Jobs

Scheduled tasks for data processing:
  • Sync Cover Manager: Every 30 minutes
  • Sync Revo TPV: Every 15 minutes
  • Calculate Loyalty: Daily at 2 AM
From frontend/lib/inngest/functions.ts

Pre-Built RFM Workflows

Hiro includes 6 pre-configured RFM workflows:

Champions VIP Experience

Trigger: Customer in Champions segment (RFM 555)Action: Offer exclusive VIP experience every 3 monthsPurpose: Maintain and maximize your best customers
{
  trigger: 'rfm-champions',
  frequency: 'every 90 days',
  template: 'champions-vip-experience',
  priority: 'high'
}

At Risk Re-engagement

Trigger: Customer in At Risk segment (inactive 90+ days)Action: Send re-engagement campaign immediatelyPurpose: Win back customers before they churn
{
  trigger: 'rfm-at-risk',
  frequency: 'once per 30 days',
  template: 'at-risk-comeback',
  priority: 'high',
  send_immediately: true
}

Cannot Lose Them Urgent

Trigger: High-value customer at risk (inactive 120+ days)Action: Urgent personalized campaign + team notificationPurpose: Emergency intervention for valuable customers
{
  trigger: 'rfm-cannot-lose',
  frequency: 'every 15 days',
  template: 'cannot-lose-urgent',
  priority: 'high',
  notify_team: true
}

Hibernating Reawakening

Trigger: Customer hibernating (inactive 180+ days)Action: Reactivation campaign every 2 monthsPurpose: Last-ditch effort to recover lost customers
{
  trigger: 'rfm-hibernating',
  frequency: 'every 60 days',
  template: 'hibernating-reawakening',
  priority: 'medium'
}

Loyal Customers Engagement

Trigger: Customer in Loyal segmentAction: Special offers every 60 daysPurpose: Keep loyal customers engaged
{
  trigger: 'rfm-loyal',
  frequency: 'every 60 days',
  template: 'loyal-customers-return',
  priority: 'medium'
}

Potential Loyalists Onboarding

Trigger: New customer with high potential (2-5 visits)Action: Premium onboarding sequencePurpose: Convert new customers into loyal ones
{
  trigger: 'rfm-potential',
  frequency: 'once',
  template: 'potential-loyalists-welcome',
  priority: 'medium'
}
Complete workflow definitions in frontend/lib/automations/rfm-workflows.ts:29-224

Behavioral Workflows

These workflows trigger based on customer actions:

Birthday Celebration

Trigger: 7 days before customer’s birthday Action: Send birthday offer
{
  id: 'birthday-automatic-celebration',
  trigger_type: 'birthday',
  trigger_condition: 'in_days',
  trigger_value: '7',
  action_type: 'create_campaign_with_template',
  action_payload: {
    template_id: 'birthday-celebration',
    channel: 'email'
  },
  priority: 'high'
}
From frontend/lib/automations/rfm-workflows.ts:233-261

NPS Negative Escalation

Trigger: Customer gives NPS ≤ 6 Action: Alert team + send follow-up
{
  id: 'nps-negative-escalation',
  trigger_type: 'nps_score',
  trigger_condition: '<=',
  trigger_value: '6',
  action_type: 'internal_alert_and_campaign',
  action_payload: {
    alert_team: true,
    alert_channels: ['email', 'slack'],
    create_followup_campaign: true
  },
  priority: 'high'
}
From frontend/lib/automations/rfm-workflows.ts:263-292

First Reservation Welcome

Trigger: Customer completes first reservation Action: Send welcome email 1 day later
{
  id: 'first-reservation-welcome',
  trigger_type: 'reservation_completed',
  trigger_condition: 'first_visit',
  action_type: 'create_campaign_with_template',
  action_payload: {
    template_id: 'potential-loyalists-welcome',
    schedule_offset_days: 1
  },
  priority: 'medium'
}
From frontend/lib/automations/rfm-workflows.ts:294-322

Post-Visit Feedback Request

Trigger: 2 days after reservation completion Action: Request feedback (max once per 30 days)
{
  id: 'reservation-completed-feedback',
  trigger_type: 'reservation_completed',
  trigger_condition: 'days_after',
  trigger_value: '2',
  trigger_config: {
    days_after_completion: 2,
    exclude_if_recent_feedback: true,
    feedback_cooldown_days: 30
  },
  priority: 'medium'
}
From frontend/lib/automations/rfm-workflows.ts:324-352

Enabling Workflows

1

Navigate to Marketing > Automations

Access the automation dashboard from the main navigation.
2

Browse Available Workflows

Review pre-built workflows organized by category:
  • RFM Workflows
  • Behavioral Workflows
  • Temporal Workflows
3

Enable a Workflow

Toggle the switch next to the workflow you want to activate.The workflow will:
  1. Start monitoring for trigger conditions
  2. Execute actions when conditions are met
  3. Track execution history
4

Configure Workflow Settings (Optional)

Click the workflow to customize:
  • Frequency limits
  • Email templates
  • Target segments
  • Notification recipients
5

Test the Workflow

Use the “Test” button to simulate the workflow with sample data.

Workflow Execution Flow

1

Trigger Detection

System monitors for trigger conditions:
// Check interval varies by trigger type
trigger_config: {
  check_interval: 'daily' | 'realtime' | 'weekly'
}
2

Condition Validation

Verify all conditions are met:
// Example: At Risk workflow
{
  rfm_segment: 'rfm-at-risk',
  min_days_since_last_visit: 90,
  min_days_since_last_automation: 30  // Don't spam
}
3

Action Execution

Perform the configured action:
action_type: 'create_campaign_with_template'
action_payload: {
  template_id: 'at-risk-comeback',
  channel: 'email',
  segment_id: 'rfm-at-risk',
  auto_schedule: true
}
4

Logging & Tracking

Record execution in automation history:
  • Timestamp
  • Affected customers
  • Action taken
  • Result (success/failure)

Advanced Workflow Configuration

Frequency Limits

Prevent over-communication:
trigger_config: {
  min_days_since_last_automation: 30  // Wait 30 days between runs
}

action_config: {
  max_per_customer: 1,                // Only once per customer
  max_per_customer_per_year: 1        // Only once per year (birthdays)
}

Conditional Actions

Execute different actions based on conditions:
Cannot Lose Them workflow:
{
  send_immediately: true,
  notify_team: true,              // Alert team
  max_per_customer: 2             // Allow multiple attempts
}

Background Jobs

Hiro runs scheduled jobs for data processing:

Cover Manager Sync

Schedule: Every 30 minutes Purpose: Sync reservations from Cover Manager
export const syncCoverManager = inngest.createFunction(
  { 
    id: 'sync-cover-manager',
    retries: 3,
  },
  { 
    cron: '*/30 * * * *',  // Every 30 minutes
  },
  async ({ event, step }) => {
    return await step.run('sync-reservations', async () => {
      // Sync logic
    });
  }
);
From frontend/lib/inngest/functions.ts:15-50

Revo TPV Sync

Schedule: Every 15 minutes Purpose: Sync orders and revenue from Revo POS
export const syncRevo = inngest.createFunction(
  { 
    id: 'sync-revo',
    retries: 3,
  },
  { 
    cron: '*/15 * * * *',  // Every 15 minutes
  },
  async ({ event, step }) => {
    // Sync logic
  }
);
From frontend/lib/inngest/functions.ts:56-91

Loyalty Calculation

Schedule: Daily at 2 AM Purpose: Calculate customer RFM scores and loyalty tiers
export const calculateLoyalty = inngest.createFunction(
  { 
    id: 'calculate-loyalty',
    retries: 2,
  },
  { 
    cron: '0 2 * * *',  // Daily at 2 AM
  },
  async ({ event, step }) => {
    // Calculate RFM, assign tiers
  }
);
From frontend/lib/inngest/functions.ts:97-130

Manual Workflow Triggers

You can manually trigger workflows via API:
import { createClient } from '@/lib/supabase/client';

// Manually run a workflow for a specific customer
async function triggerWorkflow(workflowId: string, customerId: string) {
  const response = await fetch(`/api/automations/${workflowId}/run`, {
    method: 'POST',
    body: JSON.stringify({ customerId })
  });
  
  return response.json();
}

// Example: Trigger birthday workflow
await triggerWorkflow('birthday-automatic-celebration', 'customer-123');

Monitoring Automation Performance

Automation Dashboard

View key metrics:
  • Active Workflows: How many workflows are running
  • Executions Today: Total triggers today
  • Success Rate: Percentage of successful executions
  • Top Performing: Workflows with highest engagement

Execution History

Track individual workflow runs:
interface WorkflowExecution {
  id: string;
  workflow_id: string;
  customer_id: string;
  triggered_at: string;
  completed_at: string;
  status: 'success' | 'failure' | 'pending';
  action_taken: string;
  result: Record<string, any>;
}

Debugging Failed Workflows

Check logs when a workflow fails:
  1. Navigate to Marketing > Automations
  2. Click on the workflow
  3. View Execution History
  4. Click on failed execution
  5. Review error details and customer data

Best Practices

Start with High-Priority Workflows

Enable these first:
  • Cannot Lose Them (save high-value customers)
  • At Risk Re-engagement (prevent churn)
  • NPS Negative Escalation (fix issues fast)

Set Appropriate Frequency Limits

Avoid spam:
  • Champions: Every 90 days
  • At Risk: Every 30 days
  • Hibernating: Every 60 days
  • Feedback: Max once per 30 days

Personalize Email Templates

Customize templates with:
  • Customer name
  • Favorite dishes
  • Last visit date
  • Loyalty tier

Monitor and Optimize

Track metrics weekly:
  • Open rates by workflow
  • Conversion rates
  • Customer responses
  • Adjust templates and timing

Troubleshooting

Check:
  1. Workflow is enabled (toggle is ON)
  2. Trigger conditions are being met
  3. Frequency limits haven’t been hit
  4. Customer is in the correct segment
View execution logs for debugging.
Review frequency settings:
trigger_config: {
  min_days_since_last_automation: 30  // Increase this
}

action_config: {
  max_per_customer: 1  // Limit executions
}
Check Inngest dashboard:
  1. Navigate to /api/inngest
  2. Verify function is registered
  3. Check last execution time
  4. Review error logs
Restart the function if needed:
npm run inngest:dev
Verify template variables:
  • All placeholders exist in customer data
  • Date formats are correct
  • Images are accessible
  • Links are valid
Test with sample data before deploying.

Next Steps

View Analytics

Track automation performance in the analytics dashboard

Customer Segmentation

Learn how RFM segments power automation

Email Templates

Customize templates for your workflows

Automations API

Trigger workflows programmatically

Build docs developers (and LLMs) love