# Push Notification (`petrpatek/push-notification`) Actor

Send push notifications to your phone or desktop through ntfy, free and with no account. Run it directly, or attach it as an integration to any Actor to get a push when a run succeeds or fails.

- **URL**: https://apify.com/petrpatek/push-notification.md
- **Developed by:** [Petr Pátek](https://apify.com/petrpatek) (community)
- **Categories:** Developer tools, Integrations, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Push Notification

Send a push notification to your phone or desktop through [ntfy](https://ntfy.sh), the free and open-source push service.
Run it on its own to send any message, or attach it to any Actor as an integration to get a push the moment a run succeeds, fails, times out or is aborted.

No account, no app key and no SDK: install the ntfy app, subscribe to a topic, and point this Actor at the same topic.

### What it does

- **Sends a notification** with a title, message, priority, emoji tags, a click URL, an icon and an attachment.
- **Writes run alerts for you** when used as an integration: the Actor that ran, its status, how long it took, its status message, and a tap that opens the run in Apify Console.
- **Flags failures**: a failed, aborted or timed-out run is sent at high priority with a 🚨, and a successful one with a ✅.
- **Works with your own server**: set `server` to a self-hosted ntfy and `token` to an access token for a protected topic.
- **Retries** when ntfy rate-limits or has a server error, and fails the run with ntfy's own error when the message is refused.

### Quick start

1. Install the ntfy app ([Android](https://play.google.com/store/apps/details?id=io.heckel.ntfy), [iOS](https://apps.apple.com/us/app/ntfy/id1625396347)) or open [ntfy.sh/app](https://ntfy.sh/app) in a browser.
2. Subscribe to a topic with a hard-to-guess name, such as `my-apify-alerts-7f3k2`.
   On the public ntfy.sh server anyone who knows a topic can read it.
3. Run this Actor with that `topic` and a `message`.

```json
{
    "topic": "my-apify-alerts-7f3k2",
    "title": "Backup finished",
    "message": "All 1,204 products exported.",
    "tags": ["white_check_mark"]
}
```

### Get a push after any Actor run

1. Open the Actor you want to watch in Apify Console and go to **Integrations**.
2. Choose **Connect Actor or Task**, pick **Push Notification**, and select the events, for example *Run failed* and *Run timed out*.
3. Set only the `topic` and leave `message` empty.

Apify passes the finished run to this Actor, and the notification reads like this:

> **apify/website-content-crawler: run FAILED**
> Run kT9fQ2xLm ended FAILED after 4 min 12 s.
> Navigation timed out after 60 seconds

Tapping it opens the run in Apify Console.

### Templates

`title`, `message`, `click`, `icon`, `attach`, `filename` and `tags` accept these variables when the Actor runs as an integration:

| Variable                                 | Value                                                  |
| ---------------------------------------- | ------------------------------------------------------ |
| `{{actorName}}`                          | `username/actor-name` of the Actor that ran, or its id |
| `{{status}}`                             | `SUCCEEDED`, `FAILED`, `TIMED-OUT` or `ABORTED`        |
| `{{statusMessage}}`                      | the run's status message                               |
| `{{duration}}`                           | how long the run took, such as `4 min 12 s`            |
| `{{runId}}`, `{{actorId}}`, `{{taskId}}` | ids of the run, the Actor and the task                 |
| `{{runUrl}}`                             | the run in Apify Console                               |
| `{{datasetId}}`                          | the run's default dataset                              |
| `{{eventType}}`                          | the event, such as `ACTOR.RUN.FAILED`                  |
| `{{startedAt}}`, `{{finishedAt}}`        | ISO timestamps                                         |

An unknown variable is left as written, so a typo shows in the notification instead of disappearing.

Example: `"title": "Scraper {{status}}"`, `"message": "{{duration}}, data in dataset {{datasetId}}"`.

### Input

| Field                        | Default                                           | Description                                                 |
| ---------------------------- | ------------------------------------------------- | ----------------------------------------------------------- |
| `topic`                      |                                                   | The ntfy topic. Required.                                   |
| `message`                    | run summary                                       | The body. Required unless the Actor runs as an integration. |
| `title`                      | `{{actorName}}: run {{status}}` as an integration | The title.                                                  |
| `priority`                   | 3, or 4 for a failed run                          | 1 (min) to 5 (max).                                         |
| `tags`                       | ✅ or 🚨 as an integration                        | Emoji short codes or plain tags.                            |
| `click`                      | the run in Console as an integration              | Opened when the notification is tapped.                     |
| `server`                     | `https://ntfy.sh`                                 | A self-hosted ntfy server.                                  |
| `token`                      |                                                   | An ntfy access token, stored as a secret.                   |
| `markdown`                   | `false`                                           | Render the message as Markdown in the web app.              |
| `icon`, `attach`, `filename` |                                                   | An icon URL, an attachment URL and its file name.           |
| `delay`                      |                                                   | Deliver later, such as `30m` or `tomorrow 10am`.            |

### Output

One dataset row per notification: what was sent and ntfy's message id.
The access token is never stored.

```json
{
    "server": "https://ntfy.sh",
    "topic": "my-apify-alerts-7f3k2",
    "title": "apify/website-content-crawler: run FAILED",
    "message": "Run kT9fQ2xLm ended FAILED after 4 min 12 s.",
    "priority": 4,
    "tags": ["rotating_light"],
    "click": "https://console.apify.com/actors/.../runs/kT9fQ2xLm",
    "messageId": "PV0b4Gw3ojJb",
    "sentAt": "2026-10-30T10:02:06.000Z",
    "eventType": "ACTOR.RUN.FAILED"
}
```

### Cost

The Actor is free.
It runs in 128 MB for a second or two, so each notification costs a tiny fraction of a cent in platform usage.
The public ntfy.sh server is free within its [rate limits](https://docs.ntfy.sh/publish/#limitations).

# Actor input Schema

## `topic` (type: `string`):

The ntfy topic to publish to. Subscribe to the same topic in the ntfy app. On the public ntfy.sh server anyone who knows the topic can read it, so pick a hard-to-guess name.

## `message` (type: `string`):

The notification body. Leave empty when the Actor runs as an integration: it then writes the run's status, duration and status message. You can use {{status}}, {{actorName}}, {{runId}}, {{duration}}, {{runUrl}}, {{datasetId}} and {{eventType}}.

## `title` (type: `string`):

The notification title. As an integration it defaults to "{{actorName}}: run {{status}}". The same {{variables}} as in the message work here.

## `priority` (type: `integer`):

1 (min) to 5 (max); 3 is ntfy's default. As an integration a failed, aborted or timed-out run is sent at 4 unless you set this.

## `tags` (type: `array`):

ntfy tags. A tag that is an emoji short code, such as warning or white_check_mark, shows as that emoji.

## `click` (type: `string`):

Opened when the notification is tapped. As an integration it defaults to the run in Apify Console.

## `server` (type: `string`):

Your ntfy server, if you host one.

## `token` (type: `string`):

An ntfy access token (tk\_...) for a protected topic or a server that requires login.

## `markdown` (type: `boolean`):

Render the message as Markdown in the ntfy web app.

## `icon` (type: `string`):

A JPEG or PNG shown next to the notification on Android.

## `attach` (type: `string`):

A file URL to attach, such as a screenshot or a report.

## `filename` (type: `string`):

The name the attachment is shown under.

## `delay` (type: `string`):

Deliver later, for example 30m, 2h or tomorrow 10am. The public server keeps a delayed message for up to 3 days.

## Actor input object example

```json
{
  "topic": "my-apify-alerts-change-me",
  "server": "https://ntfy.sh",
  "markdown": false
}
```

# Actor output Schema

## `notifications` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "topic": "my-apify-alerts-change-me"
};

// Run the Actor and wait for it to finish
const run = await client.actor("petrpatek/push-notification").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "topic": "my-apify-alerts-change-me" }

# Run the Actor and wait for it to finish
run = client.actor("petrpatek/push-notification").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "topic": "my-apify-alerts-change-me"
}' |
apify call petrpatek/push-notification --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,petrpatek/push-notification"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/2mWMAj78xONQ5YeDz/builds/cQeC9mE7J49786pP8/openapi.json
