Workflows

Autonomous agents that monitor conditions and take action. Set up intelligent automation for your farming operation.

Workflows are autonomous agents that run in the background, monitoring conditions and taking action on your behalf. They combine triggers, conditions, and actions to automate routine tasks and send timely alerts.

How Workflows Work

Every workflow follows this pattern:

TRIGGER → EVALUATE CONDITIONS → EXECUTE ACTIONS
  1. Trigger - Something initiates the workflow (schedule, webhook, threshold, message)
  2. Conditions - Optional rules that determine if actions should run
  3. Actions - What happens when triggered (notifications, tasks, API calls, AI responses)

Workflow Types

Scheduled Workflows

Run on a schedule (daily, weekly, or custom cron):

  • Daily Farm Brief - Morning summary of weather, tasks, and alerts
  • Weekly Equipment Check - Maintenance reminders based on hours
  • Monthly Reports - Automated report generation and delivery

Threshold Workflows

Monitor data and trigger when thresholds are crossed:

  • Weather Alerts - Notify when frost, heat, or wind thresholds are exceeded
  • Equipment Alerts - Alert when service intervals are due
  • Inventory Alerts - Notify when supplies run low

Webhook Workflows

Triggered by external systems via HTTP:

  • IoT Sensors - React to sensor data from connected devices
  • External APIs - Integrate with third-party agricultural systems
  • Custom Integrations - Build your own triggers

Messaging Workflows

Triggered by incoming messages:

  • WhatsApp Commands - Respond to team messages
  • Telegram Bots - Field queries via chat
  • SMS Keywords - Simple mobile interactions

Creating a Workflow

From the Catalog

The fastest way to get started:

  1. Navigate to Workflows
  2. Click Add Workflow
  3. Browse the catalog by category
  4. Select a template
  5. Configure parameters
  6. Activate

From Scratch

For custom workflows:

  1. Navigate to Workflows
  2. Click Add Workflow
  3. Choose Start from Scratch
  4. Select a trigger type
  5. Add conditions (optional)
  6. Add actions
  7. Test and activate

Trigger Types

Cron (Scheduled)

Run workflows on a schedule:

ScheduleCron ExpressionExample Use
Daily at 6am0 6 * * *Morning briefing
Weekly Monday0 8 * * 1Weekly review
Every 4 hours0 */4 * * *Regular monitoring
First of month0 9 1 * *Monthly reports

Webhook

Receive HTTP POST requests:

bash
POST https://headlands.ag/api/webhooks/{workflow_id}
Content-Type: application/json
{
"sensor_id": "field-station-1",
"temperature": 28,
"humidity": 85
}

Webhook data is available in conditions and actions as {{webhook.field_name}}.

Threshold

Monitor data sources continuously:

  • Weather - Temperature, wind, precipitation, humidity
  • Equipment - Hours, maintenance status, fuel
  • Inventory - Stock levels, expiration dates
  • Custom - Any numeric field in your data

Messaging

Respond to incoming messages:

  • WhatsApp - Link your WhatsApp Business account
  • Telegram - Connect your Telegram bot
  • Message content available as {{message.text}}

Conditions

Conditions determine whether actions execute after a trigger fires.

Field Conditions

Check field-level data:

IF field.current_crop = "corn" AND field.growth_stage = "V6"

Temporal Conditions

Time-based rules:

IF day_of_week IN ["Monday", "Wednesday", "Friday"] AND hour BETWEEN 6 AND 18

Value Conditions

Compare values using JSONPath:

IF webhook.temperature > 95 OR webhook.humidity < 20

Logic Conditions

Combine conditions:

  • AND - All conditions must be true
  • OR - Any condition can be true
  • NOT - Inverts a condition

Actions

What happens when a workflow executes.

Notification

Send alerts via multiple channels:

ChannelConfiguration
PushSends to mobile/web app
EmailTo specified addresses
SMSTo phone numbers (Twilio)
WhatsAppTo linked WhatsApp number
TelegramTo linked Telegram chat

Task Creation

Automatically create tasks:

Create task: Title: "Check field {{trigger.field_name}}" Description: "Temperature exceeded threshold at {{trigger.value}}°F" Priority: High Assign to: Current user

Webhook Call

Call external APIs:

POST https://api.external-system.com/alerts Headers: Authorization: Bearer {{secrets.API_KEY}} Body: { "alert": "{{trigger.description}}", "severity": "high" }

AI Response

Generate intelligent responses:

Generate AI response: Context: Include recent weather and field data Prompt: "Provide recommendations for the current conditions" Send via: WhatsApp

Record Update

Update data in your knowledge base:

Update equipment record: Equipment: Tractor 42 Field: last_alert_date Value: {{now}}

Skill Execution

Run built-in skills:

Execute skill: Skill: withdrawal_period_calculator Inputs: drug_name: "LA-200" treatment_date: "{{trigger.date}}" Store result in: withdrawal_date

Action Chains

Actions can be chained together, with later actions using results from earlier ones:

1. Execute skill: weather_analysis Store as: weather_data 2. Generate AI response: Include: {{weather_data.recommendation}} Store as: ai_recommendation 3. Send notification: Message: {{ai_recommendation}}

Variables & Templates

Available Variables

SourceVariables
Trigger{{trigger.type}}, {{trigger.data.*}}
Webhook{{webhook.*}} (any posted field)
Message{{message.text}}, {{message.from}}
Context{{now}}, {{today}}, {{user.name}}
Previous actionsNamed results from earlier actions

Template Syntax

Use Handlebars-style templates:

Good morning {{user.name}}! Today's weather: {{weather.description}} High: {{weather.high}}°F / Low: {{weather.low}}°F Upcoming tasks: {{#each tasks}} - {{this.title}} (due {{this.due_date}}) {{/each}}

Testing Workflows

Test Run

Before activating:

  1. Click Test on the workflow
  2. Provide sample trigger data
  3. Review condition evaluation
  4. Preview action outputs
  5. Confirm expected behavior

Execution History

Monitor running workflows:

  1. Navigate to Executions in sidebar
  2. Filter by workflow
  3. View execution details:
    • Trigger data
    • Condition results
    • Action outcomes
    • Errors or warnings

Workflow Catalog

Headlands includes 40+ pre-built workflow templates:

Tier Zero (Free)

  • Daily Farm Brief
  • Weather Alert Monitor
  • Task Reminder
  • Simple WhatsApp Responder

Tier One (Professional)

  • Spray Window Advisor
  • Equipment Maintenance Scheduler
  • Cattle Health Monitor
  • Harvest Coordinator
  • Soil Moisture Analyst
  • Pest Pressure Tracker
  • Compliance Deadline Manager
  • Market Price Watcher
  • Irrigation Scheduler
  • Feed Inventory Monitor
  • Grazing Rotation Planner

Tier Two (Enterprise)

  • Custom integration templates
  • Multi-farm aggregators
  • Advanced analytics workflows
  • Third-party system connectors

Browse the full catalog at Workflow Catalog.

Best Practices

Start Simple

Begin with catalog templates and customize gradually. A working simple workflow beats a complex broken one.

Use Descriptive Names

Name workflows clearly:

  • Good: "Daily Morning Brief - 6am - Push + Email"
  • Bad: "Workflow 1"

Test Thoroughly

Always test with realistic data before activating. Check both true and false condition paths.

Monitor Executions

Review execution history weekly. Look for:

  • Unexpected failures
  • Excessive executions
  • Missing expected runs

Document Custom Workflows

Add descriptions explaining:

  • Why the workflow exists
  • What triggers it
  • What actions it takes
  • Who should be notified of issues

Troubleshooting

Workflow Not Triggering

  • Check that the workflow is activated (toggle on)
  • Verify the trigger configuration (correct time, webhook URL, etc.)
  • Review execution history for errors
  • Check condition logic isn't blocking all executions

Actions Not Executing

  • Verify conditions are evaluating to true
  • Check action configuration for errors
  • Ensure notification channels are configured (phone numbers, emails)
  • Review execution logs for specific error messages

Notifications Not Received

  • Confirm notification channel is set up in Settings
  • Check spam/junk folders for email
  • Verify phone numbers include country code
  • Ensure WhatsApp/Telegram is properly linked