Opening Problem Statement
Meet Jack, a facility manager at a manufacturing plant who spends countless hours manually tracking machine alerts. Every day, Jack receives alerts from various systems that indicate machine statuses such as new alerts, acknowledgments, closures, or annotations. Without an automated way to update and track these alert statuses, Jack faces delayed responses, errors in status updates, and incomplete documentation of machine events. This disorganized manual approach leads to productivity loss, increased downtime, and costly mistakes correcting missed or miscommunicated alerts.
Imagine Jack having to sift through emails, spreadsheets, and multiple software platforms just to ensure a machine alert is acknowledged or resolved. This process consumes valuable time and leads to human errors—such as failing to note if a machine alert was truly closed or annotated with important information from operators on the floor.
This is precisely the problem the n8n workflow we’ll explore solves by automating the machine alert tracking process, integrating Signl4 alerts with Notion databases, and updating statuses with precision and speed.
What This Automation Does
This n8n workflow seamlessly automates the management of machine alerts by bridging incoming webhook data from Signl4 alerts with Notion database updates. Here’s what happens when it runs:
- Receives real-time machine alert data via a webhook trigger from Signl4.
- Processes the alert status through a customized Function node that decodes the alert’s status code and event type to categorize it (e.g., New Alert, Acknowledged, Closed).
- Updates the corresponding Notion database page with the processed alert status, user details, and annotations dynamically.
- Polls Notion for open and new alerts periodically to ensure synchronization between Signl4 and Notion.
- Resolves or sends new alert notifications back to Signl4 based on the Notion database’s current alert status.
- Marks alerts as read and updates resolution states automatically, reducing manual tracking and errors.
These outcomes save Jack several hours every week by eliminating manual status updates and improving alert visibility and response coordination among team members.
Prerequisites ⚙️
- Signl4 account with API access (to receive and send alerts)
- Notion account with a configured database for machine alerts
- n8n account (cloud or self-hosted) capable of running workflows and connecting to APIs
- Webhook setup in n8n to receive POST requests from Signl4
- Credentials configured for Notion API and Signl4 API within n8n
Step-by-Step Guide
Step 1: Set Up the Webhook Node to Receive Alerts
In n8n, click +Add Node and select Webhook. Configure the path (e.g., 95fd62c7-fc8c-4f6f-8441-bbf85a2da81a) and set the method to POST. This webhook acts as the entry point that accepts incoming machine alert data from Signl4.
Once configured, n8n will provide a URL endpoint. Use this URL when configuring Signl4 to send alerts to your workflow.
Common Mistake: Forgetting to enable the webhook or correctly copy the URL into Signl4 settings will prevent alerts from triggering the workflow.
Step 2: Use a Function Node to Decode Alert Status
Add a Function node connected to the Webhook node. Paste the custom JavaScript code provided below into the Function Code box.
// Loop over inputs and add a new field called 's4Status' based on alert status and event type
for (item of items) {
var type = "Status";
if ((item.json.body.alert.statusCode == 2) && (item.json.body.eventType == 201)) { type = "Acknowledged"; }
if ((item.json.body.alert.statusCode == 4) & (item.json.body.eventType == 201)) { type = "Closed"; }
if ((item.json.body.alert.statusCode == 1) & (item.json.body.eventType == 200)) { type = "New Alert"; }
if ((item.json.body.alert.statusCode == 16) & (item.json.body.eventType == 201)) { type = "No one on duty"; }
var annotation = "";
if ((item.json.body.eventType == 203) && (item.json.body.annotation != undefined)) {
type = "Annotated";
annotation = item.json.body.annotation.message;
}
if (annotation != "") { annotation = ": " + annotation; }
var username = "System";
if (item.json.body.user != undefined) { username = item.json.body.user.username; }
var data = type + " by " + username + annotation;
item.json.s4Status = data;
item.json.s4Up = false;
if (type == "Closed") { item.json.s4Up = true; }
}
return items;
This code analyses incoming alert details and generates a readable status message stored in s4Status and a boolean s4Up which is true if the alert is closed.
Common Mistake: Copying code incorrectly, especially logical operators like && and &, can break the function.
Step 3: Update Notion Page With Processed Alert Status
Add a Notion node after the Function node. Configure it to update a database page:
- Set Page ID to
{{$node["Webhook"].json["body"]["alert"]["externalEventId"]}}to target the correct alert entry - Choose Update operation on a databasePage resource
- Map the Description rich text property to
{{$node["Function"].json["s4Status"]}}
This ensures the alert status is clearly documented in Notion for the corresponding alert.
Common Mistake: Using the wrong pageId or property key can cause update failures.
Step 4: Poll Notion for Open and New Alerts Using Interval
Add an Interval node set to trigger every 20 seconds. Connect it to two Notion nodes configured to:
- Notion Read Open: Retrieve all database pages where “Up” and “Read” checkboxes are true.
- Notion Read New: Retrieve all database pages where “Read” and “Up” checkboxes are false.
This polling keeps the workflow synchronized with Notion’s current alert states.
Common Mistake: Not setting appropriate filters can return incorrect data sets increasing unnecessary processing.
Step 5: Trigger Signl4 Alerts for New Entries
Add a SIGNL4 Alert node connected to the “Notion Read New” node, configured to:
- Send a message like “Machine Alert: [Alert Name]”
- Set title to “n8n Alert”
- Use the alert’s page ID as externalId
- Provide fixed location coordinates (latitude: 52.3992137, longitude: 13.0583823)
This notifies the Signl4 app team about new unacknowledged machine alerts for immediate attention.
Common Mistake: Forgetting to provide the correct externalId links notification to Notion entries.
Step 6: Mark Notion Alerts as Read Post Notification
Connect Notion Update Read node downstream of the Signl4 Alert node. Configure this node to update the “Read” checkbox to true for the respective alert page, confirming the alert has been acknowledged in Notion.
Common Mistake: Missing the update leads to repeated notifications since alerts remain marked unread.
Step 7: Resolve Alerts in Signl4 for Open and Read Alerts
Link the “Notion Read Open” node to a SIGNL4 Resolve node that:
- Calls the resolve operation on SIGNL4 for alerts with “Up” and “Read” true
- Uses Notion page ID as externalId for correlation
This closes the alert in Signl4 once it’s handled in Notion.
Common Mistake: Not properly filtering open and read alerts can cause premature resolution.
Step 8: Clear Read Flags in Notion Once Alert is Resolved
From the “SIGNL4 Resolve” node, chain a Notion Update Final node configured to:
- Clear the “Read” checkbox for the corresponding alert page to reset its state for future alerts
Common Mistake: Failing to clear flags can clutter your database with stale alerts.
Customizations ✏️
- Change Alert Status Definitions: In the Function node’s JavaScript, modify the
statusCodeandeventTypemappings to reflect your organization’s alert categories. - Adjust Polling Interval: Modify the Interval node schedule for faster or slower Notion sync cycles based on operational needs.
- Add More Properties in Notion Update: Include other metadata fields like priority or timestamp from alert payload to Notion page updates.
- Dynamic Location Data: Replace hardcoded latitude and longitude in Signl4 nodes with dynamic fields sourced from alert data.
- Enable Disabled Notion Trigger: Use the Notion Trigger node to activate alerts based on new pages added, complementing webhook data ingestion.
Troubleshooting 🔧
- Problem: “No data appears at the webhook trigger”
Cause: Incoming alert POST request not reaching n8n webhook.
Solution: Ensure webhook URL is correctly copied into Signl4 webhook configuration; test with tools like Postman to verify endpoint receiving data. - Problem: “Notion update fails with error: pageId invalid”
Cause: Incorrect page ID passed to Notion node.
Solution: Double-check the pageId expression, ensure it correctly points to the externalEventId from webhook payload. - Problem: “Function node crashes or syntax errors”
Cause: JavaScript syntax issues, especially misuse of logical operators.
Solution: Carefully copy/paste the function code; validate syntax in n8n editor with console output enabled. - Problem: “Repeated alerts sent to SIGNL4”
Cause: Alerts are not marked as Read in Notion, causing re-trigger.
Solution: Confirm that Notion Update Read node runs properly to set the Read checkbox as true after notification.
Pre-Production Checklist ✅
- Confirm Notion database schema matches required properties including “Read” and “Up” checkboxes, and “Description” rich text.
- Test webhook URL externally (e.g., Postman) to verify incoming alert payloads.
- Run the Function node standalone with sample data to ensure status processing is correct.
- Verify Signl4 API credentials and connectivity.
- Perform test alerts through Signl4 and confirm updates in Notion happen as expected.
- Have backup of Notion database or workflow export before enabling production automation.
Deployment Guide
Activate the webhook node to start listening for machine alerts. Enable the Interval node to periodically poll Notion for open and new alerts ensuring real-time synchronization. Monitor workflow execution logs within n8n for errors or bottlenecks. Set retry strategies on critical nodes.
Regularly audit the Notion database for alert status consistency and alert delivery in Signl4. Consider integrating with team communication channels for further escalation alerts if needed.
FAQs
- Q: Can I replace Notion with another database?
A: Yes, but you would need to use corresponding n8n nodes and map data fields accordingly. - Q: Does this workflow consume many API calls?
A: It uses API calls mainly when handling alerts and during interval polling, so monitor your plan limits. - Q: Is my data secure?
A: Data security depends on your n8n hosting and API credential management; always use secure connections. - Q: Can this workflow handle high alert volumes?
A: Yes, but you may need to optimize Interval polling frequency and node execution concurrency.
Conclusion
By following this guide, you’ve set up a powerful automation that connects Signl4 machine alerts with Notion’s powerful database capabilities through n8n. You’ve eliminated the tedious manual process of tracking alert statuses, cutting down hours spent on updates and reducing human error.
This workflow not only keeps your team informed in real-time but also ensures each alert is properly documented, acknowledged, and closed. Jack’s time is now freed up for higher-priority tasks instead of chasing machine alert updates.
Up next, consider adding integrations with Slack for alert notifications, or storing detailed alert logs in Google Sheets for audit purposes. Your alert management just got smarter and more efficient with n8n!