Send Node-RED sensor events and flow results to iPhone, Android, and the web
Send Node-RED flow notifications
Forward sensor events, automation results, and messages from Node-RED to Signalgrid push notifications. This guide uses built-in Inject, Function, HTTP Request and Debug nodes. The Function node prepares an encoded form body for the Signalgrid Push API.
Prerequisites
- A Node-RED instance with permission to edit and deploy flows.
- The built-in Function and HTTP Request nodes enabled.
- A Signalgrid account with an iPhone, Android device, or web client registered to receive notifications.
- Your Signalgrid client key and a channel token. Use the channel token rather than the channel name.
- Outbound HTTPS access to
https://api.signalgrid.co.
Set the credentials
Open the flow's properties and add these environment variables. Node-RED exposes flow environment variables to a Function node through env.get.
SIGNALGRID_CLIENT_KEYYOUR_CLIENT_KEYSIGNALGRID_CHANNELYOUR_CHANNEL_TOKENUse your own credentials, then save the flow properties. Treat the flow configuration as private and remove credentials before sharing exports. You can also provide these variables through your existing Node-RED runtime environment.
Build the test flow
- Add an Inject node, a Function node, an HTTP Request node and a Debug node.
- Wire them in that order.
- Set the Inject payload type to string and its value to Your Node-RED notification has arrived.
- Paste the following into the Function node's main code editor.
The function builds the body from msg.payload and URL-encodes each field. It replaces the outgoing headers with the content type required by this request. Do not attach a Debug node to this request message: it contains credentials. Inspect only the API response after the HTTP Request node.
Configure the HTTP Request node
POSThttps://api.signalgrid.co/v1/pushLeave configured headers empty so the node uses msg.headers from the Function node. Set the final Debug node to show only msg.payload. Deploy the flow and click the Inject button.
Check the test result
The Debug sidebar should show an API response containing text: OK and code: 200. Also confirm that your phone or web client received the notification. HTTP status is available as msg.statusCode after the HTTP Request node.
Use sensor values and flow results
Replace the Inject node with the existing part of your flow that produces a message. The example expects a string or number as its payload. For an object, choose the relevant property or change the body expression to JSON.stringify(msg.payload) before the form encoding step. Set a descriptive fixed title for the flow, such as Temperature warning or Import completed.
Only send when the event matters. Use a Switch node to select a threshold or state, and an RBE node when you want to suppress unchanged values. Keep the notification on the path that represents the result you want to report.
Send critical alerts
For urgent incidents, set critical to true and type to CRIT. These are separate settings: the visual notification type alone does not enable critical delivery. Critical notifications require a Single or Teams subscription and the appropriate device permissions. See Critical Notifications for iOS Critical Alerts and Android notification settings. Keep routine results non-critical.
In the Function node's fields object, change type: "INFO" to type: "CRIT" and critical: "false" to critical: "true" for an urgent event.
Troubleshooting
- The function reports missing variables: check the exact variable names in flow properties or your runtime environment, then deploy.
- The API rejects the message: inspect the response and check the credentials, POST method and form content type.
- The body says [object Object]: select a text field from the incoming payload or use JSON.stringify.
- HTTP Request fails: check network access and use a Catch node scoped to the request node for connection errors.
- Many repeated alerts: filter events before the Function node. Signalgrid allows 100 requests per minute per account.
- The device stays silent: check the channel and device permissions.