Skip to main content

Webhooks & Automation

Use MachineMetrics webhooks to send real-time production events to external systems, enabling automated responses to shop floor conditions.


Overview

Webhooks are HTTP callbacks that send data to external URLs when specific events occur in MachineMetrics. Combined with Workflows, they enable powerful automations like:

  • Creating maintenance tickets when downtime occurs
  • Sending Slack alerts for quality issues
  • Updating external databases in real-time
  • Triggering custom business logic

How Webhooks Work

┌─────────────────┐     ┌──────────────────┐     ┌────────────────────┐
│ Event Trigger │────▶│ MachineMetrics │────▶│ Your Endpoint │
│ (Downtime, │ │ Webhook Action │ │ (Make.com, API, │
│ Alarm, etc.) │ │ │ │ Custom server) │
└─────────────────┘ └──────────────────┘ └────────────────────┘


POST request with
JSON payload

Creating a Webhook Workflow

Step 1: Create a New Workflow

  1. Navigate to Automations → Workflows
  2. Click Create Workflow (or New Workflow)
  3. Enter a name and description

Step 2: Configure the Trigger

Select when the webhook should fire:

Trigger TypeWhen It FiresUse Case
Downtime categorized asWhen downtime is assigned a specific categoryMaintenance requests
Alarm triggeredWhen a machine alarm activatesCritical fault alerts
Operator triggers manuallyWhen an operator clicks the workflowOn-demand actions
ScheduledAt specified timesPeriodic data syncs
Machine status changesWhen machine state changesReal-time monitoring

Step 3: Add the Webhook Action

  1. Click Add a New Action
  2. Select Webhook
  3. Configure:
    • URL: The endpoint to receive the data
    • Secret: A password to validate requests (click Generate or Create New)
    • Delay: Time to wait before sending (0 = immediate)

Step 4: Save and Enable

  1. Click Create Workflow or Save Changes
  2. Ensure the workflow is enabled (toggle on)

Webhook Payload

When triggered, MachineMetrics sends a POST request with a JSON payload containing event details.

Sample Payload Structure

{
"event": "downtime_categorized",
"timestamp": "2024-01-15T14:32:00Z",
"machine": {
"id": "abc123",
"name": "CNC Mill 01",
"group": "Milling"
},
"downtime": {
"duration_seconds": 1800,
"category": "Maintenance Required",
"notes": "Spindle bearing noise detected"
},
"operator": {
"id": "op456",
"name": "John Smith"
}
}

Payload Fields by Trigger Type

TriggerIncluded Data
DowntimeMachine, duration, category, notes, operator
AlarmMachine, alarm code, description, severity
ManualMachine, operator, workflow name
ScheduledTimestamp, workflow configuration

Securing Webhooks

Always use a secret to validate that requests originate from MachineMetrics.

How Secret Validation Works

  1. MachineMetrics includes a signature header with each request
  2. Your endpoint calculates the expected signature using the shared secret
  3. Compare signatures to verify authenticity

Generating a Secret

  1. In the webhook action, click Generate or Create New
  2. Copy and securely store the secret
  3. Configure your receiving endpoint to validate against this secret

Best Practice: Treat webhook secrets like passwords. Don't expose them in client-side code or public repositories.


Common Webhook Destinations

Integration Platforms

PlatformWebhook URL Format
Make.comhttps://hook.us1.make.com/xxxxx
Zapierhttps://hooks.zapier.com/hooks/catch/xxxxx
Power Automatehttps://prod-xx.logic.azure.com:443/workflows/xxxxx

MaintainX Integration

ActionURL
Create Work Requesthttps://maintainx.svc.machinemetrics.com/WorkRequest
Create Work Orderhttps://maintainx.svc.machinemetrics.com/WorkOrder
Update Metershttps://maintainx.svc.machinemetrics.com/Meter
Setup Asset Mappinghttps://maintainx.svc.machinemetrics.com/setup

Custom Endpoints

You can send webhooks to any URL that accepts HTTP POST requests:

  • Your own API servers
  • Cloud functions (AWS Lambda, Google Cloud Functions, Azure Functions)
  • Internal tools and databases

Workflow Examples

Example 1: Maintenance Alert

Goal: Create a MaintainX work request when downtime is categorized as "Maintenance Required"

Setup:

  • Trigger: Downtime categorized as → "Maintenance Required"
  • Action: Webhook
    • URL: https://maintainx.svc.machinemetrics.com/WorkRequest
    • Delay: 0 seconds

Example 2: Supervisor Notification

Goal: Send a Slack message when any machine is down for more than 30 minutes

Setup:

  • Trigger: Downtime duration exceeds 30 minutes
  • Action: Webhook to Make.com → Make.com sends to Slack

Example 3: Daily Production Sync

Goal: Update an external database with production counts each night

Setup:

  • Trigger: Scheduled → Daily at 11:00 PM
  • Action: Webhook to your data collection API

Example 4: Quality Inspection Request

Goal: Alert quality team when an operator flags a part for inspection

Setup:

  • Trigger: Operator triggers manually
  • Description: "Request Quality Inspection"
  • Action: Webhook → Creates a task in Trello or email to QA

Troubleshooting

Webhook Not Firing

IssueSolution
Workflow disabledCheck the workflow toggle is ON
Trigger conditions not metVerify the trigger matches your expected event
Machine not in scopeCheck if the workflow applies to the correct machines

Webhook Fires But No Action

IssueSolution
Invalid URLVerify the endpoint URL is correct and accessible
Authentication failedCheck that your secret matches on both ends
Endpoint errorCheck logs on your receiving system
TimeoutEnsure your endpoint responds within 30 seconds

Debugging Tips

  1. Test with a simple endpoint first: Use webhook.site to inspect payloads
  2. Check workflow history: View past executions in Automations → Workflows → History
  3. Start with manual triggers: Test the webhook before adding automated triggers
  4. Monitor your endpoint: Check logs for incoming requests and errors

Best Practices

  1. Use descriptive workflow names: Makes troubleshooting easier
  2. Set appropriate delays: Avoid flooding external systems with rapid-fire events
  3. Handle failures gracefully: Design receiving systems to handle duplicate or out-of-order messages
  4. Document your webhooks: Track which workflows send to which endpoints
  5. Test thoroughly: Verify end-to-end before deploying to production

Rate Limits

  • Webhooks are sent as events occur
  • No built-in rate limiting from MachineMetrics
  • Consider implementing delays for high-frequency events
  • Your receiving endpoint should handle bursts appropriately