anypush

n8n node for anypush: send push notifications and job exit statuses to an anypush channel on your Android phone

Package Information

Released: this month
Downloads: 0 weekly / 0 monthly
Latest Version: 0.1.1
Author: anypush

Documentation

n8n-nodes-anypush

An n8n community node for anypush: send push notifications, and report
a job's exit status, from a workflow to an anypush channel on your Android phone.

anypush is an Android app (on Google Play as app.anypush).
You make a channel in the app and copy its address. Free to start, no ads, Android 7 and up. Scripts and webhooks:
https://anypush.app/webhooks.

Installation

Follow the community nodes installation guide
in the n8n documentation. In short, on a self-hosted n8n, as an owner or admin:

  1. Open Settings > Community Nodes.
  2. Select Install.
  3. Enter n8n-nodes-anypush, confirm that you understand the risks of installing unverified code, and select
    Install.

The node then shows up in the nodes panel as Anypush.

Credentials

Create an Anypush Channel API credential. It has one field:

  • Channel Address: the channel's address as the anypush app shows it, https://anypush.app/h/YOUR_CHANNEL_TOKEN,
    or the token alone.

The address is a secret. Anyone who has it can push to your phone. Keep it in the credential, not in a node field or
an expression, and do not paste it into issues or shared workflows. The node never writes it to its output or its
error messages.

The credential test checks only the shape of the address. It does not contact anypush, because every request to a
channel has an effect: a message pushes, and a job status of 0 restarts the channel's "tell me when this goes quiet"
clock. A wrong or deleted channel shows on the first run as "No anypush channel at this address".

Operations

Send Message

Pushes a notification to the channel.

Field Required Notes
Message yes 1 to 4096 characters
Title no at most 256 characters
Priority no Low, Normal (default) or High
Options > URL no http or https; opened when the notification is tapped
Options > Idempotency Key no the same key on the same channel within a day sends once; anypush answers the first message again with "duplicate": true

The request is POST https://anypush.app/h/<token> with a JSON body. If you turn on the node's Retry On Fail
setting, set an Idempotency Key that is the same for each try of one logical message (for example an expression on
the item's ID), so a retry does not push twice.

Output, one item per input item:

{ "id": 1042, "duplicate": false }

anypush also answers with a status_url. The node leaves it out of the output, because it contains the channel
address; it leaves out any other field that carries the address or a token too.

Report Job Status

Reports a job's exit status, as a shell prints it ($?), for example after a backup or a cron job.

Field Required Notes
Exit Status yes 0 to 255
Log Text no the end of the job's log; shown as the alert's text
  • 0 is a silent heartbeat: no notification. It restarts the channel's "tell me when this goes quiet" clock.
  • 1 to 255 is a high-priority alert, "Exited with status N", with the end of the log text as its text. anypush
    sends at most one alert an hour per status.

The request is POST https://anypush.app/h/<token>/<status> with the log text as a plain-text body. A check-in
channel does not take job statuses and answers 409.

Errors

anypush answers The node reports Retry?
404 No anypush channel at this address: the address is wrong, or the channel was deleted no
409 (Report Job Status) This anypush channel does not take job statuses (a check-in channel) no
413 The message is too large for anypush: the whole request may be at most 64 KiB no
422 anypush refused the message, with anypush's reason (for example "The message is required.") no
429 Too many messages to this anypush channel: 60 a minute per channel, or the app's daily cap; with the Retry-After seconds later
503 anypush is briefly unavailable, with the Retry-After seconds yes

The node also checks the fields before it sends: an empty message, a URL that is not http or https, or an exit status
outside 0 to 255 stops the item without a request.

With Continue On Fail (Settings > On Error > Continue), a failed item becomes an output item such as:

{
	"error": "No anypush channel at this address",
	"description": "The channel address in the credential is wrong, or the channel was deleted. Copy the address from the anypush app again.",
	"httpCode": "404"
}

Example workflow

A heartbeat for n8n itself: every 5 minutes the workflow reports exit status 0, which pushes nothing and restarts the
channel's "tell me when this goes quiet" clock. If n8n stops, the heartbeats stop. Import it with Workflows > Import
from File
(or paste it on the canvas), then pick your Anypush Channel API credential in the anypush node.

{
	"name": "anypush heartbeat",
	"nodes": [
		{
			"parameters": { "rule": { "interval": [{ "field": "minutes", "minutesInterval": 5 }] } },
			"name": "Every 5 minutes",
			"type": "n8n-nodes-base.scheduleTrigger",
			"typeVersion": 1.2,
			"position": [0, 0]
		},
		{
			"parameters": { "operation": "reportJobStatus", "status": 0 },
			"name": "Heartbeat to anypush",
			"type": "n8n-nodes-anypush.anypush",
			"typeVersion": 1,
			"position": [220, 0]
		}
	],
	"connections": {
		"Every 5 minutes": {
			"main": [[{ "node": "Heartbeat to anypush", "type": "main", "index": 0 }]]
		}
	}
}

To send a message instead, set Operation to Send Message, for example with the message
{{ $workflow.name }} needs attention and priority High, on the error output of the node you watch.

Compatibility

Built with @n8n/node-cli 0.58.6 against n8n-workflow 2.49.4
(n8n nodes API version 1). The package has no runtime dependencies.

Development

npm install
npm run lint
npm run build
npm test        # builds, then runs test/*.test.mjs with node:test (no n8n server, no network)
npm run dev     # starts a local n8n with the node loaded (needs Docker or Podman)

The tests replace n8n's request helper with a fake and use a fake channel token.

Resources

License

MIT

Discussion