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
- Navigate to Automations → Workflows
- Click Create Workflow (or New Workflow)
- Enter a name and description
Step 2: Configure the Trigger
Select when the webhook should fire:
| Trigger Type | When It Fires | Use Case |
|---|---|---|
| Downtime categorized as | When downtime is assigned a specific category | Maintenance requests |
| Alarm triggered | When a machine alarm activates | Critical fault alerts |
| Operator triggers manually | When an operator clicks the workflow | On-demand actions |
| Scheduled | At specified times | Periodic data syncs |
| Machine status changes | When machine state changes | Real-time monitoring |
Step 3: Add the Webhook Action
- Click Add a New Action
- Select Webhook
- 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
- Click Create Workflow or Save Changes
- 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
| Trigger | Included Data |
|---|---|
| Downtime | Machine, duration, category, notes, operator |
| Alarm | Machine, alarm code, description, severity |
| Manual | Machine, operator, workflow name |
| Scheduled | Timestamp, workflow configuration |
Securing Webhooks
Always use a secret to validate that requests originate from MachineMetrics.
How Secret Validation Works
- MachineMetrics includes a signature header with each request
- Your endpoint calculates the expected signature using the shared secret
- Compare signatures to verify authenticity
Generating a Secret
- In the webhook action, click Generate or Create New
- Copy and securely store the secret
- 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
| Platform | Webhook URL Format |
|---|---|
| Make.com | https://hook.us1.make.com/xxxxx |
| Zapier | https://hooks.zapier.com/hooks/catch/xxxxx |
| Power Automate | https://prod-xx.logic.azure.com:443/workflows/xxxxx |
MaintainX Integration
| Action | URL |
|---|---|
| Create Work Request | https://maintainx.svc.machinemetrics.com/WorkRequest |
| Create Work Order | https://maintainx.svc.machinemetrics.com/WorkOrder |
| Update Meters | https://maintainx.svc.machinemetrics.com/Meter |
| Setup Asset Mapping | https://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
- URL:
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
| Issue | Solution |
|---|---|
| Workflow disabled | Check the workflow toggle is ON |
| Trigger conditions not met | Verify the trigger matches your expected event |
| Machine not in scope | Check if the workflow applies to the correct machines |
Webhook Fires But No Action
| Issue | Solution |
|---|---|
| Invalid URL | Verify the endpoint URL is correct and accessible |
| Authentication failed | Check that your secret matches on both ends |
| Endpoint error | Check logs on your receiving system |
| Timeout | Ensure your endpoint responds within 30 seconds |
Debugging Tips
- Test with a simple endpoint first: Use webhook.site to inspect payloads
- Check workflow history: View past executions in Automations → Workflows → History
- Start with manual triggers: Test the webhook before adding automated triggers
- Monitor your endpoint: Check logs for incoming requests and errors
Best Practices
- Use descriptive workflow names: Makes troubleshooting easier
- Set appropriate delays: Avoid flooding external systems with rapid-fire events
- Handle failures gracefully: Design receiving systems to handle duplicate or out-of-order messages
- Document your webhooks: Track which workflows send to which endpoints
- 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
Related Articles
- ERP Integration Guide — Connect your ERP system
- Third-Party App Integrations — MaintainX, Make.com setup
- API Integration Guide — Pull data via REST API