Publish notification
The Publish notification action publishes a notification message to a ntfy topic.
With the Publish notification action you can take full advantage of the ntfy service’s capabilities. You can customize the message content and appearance with priority, links, attachments, tags, emojis, and more.
Using this action from the user interface
If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.
To send a notification from an automation or a script:
- Go to Settings > Automations & scenes.
- Open an existing automation or script, or select Create automation > Create new automation.
- If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
- In the Then do section, select Add action.
- From the search box, search for and select ntfy: Publish notification.
- Under Targets, select the topics you want to notify (see Targets).
- Optional: Customize message priority, incorporate emojis, or add interactive elements like URLs, attachments, and action buttons.
- Select Save.
Options in the UI
Your notification message. Defaults to the string triggered if no value is provided.
Enable Markdown formatting for the message body. See the Markdown guide for syntax details.
Add tags or emojis to the notification. Emojis (using shortcodes like smile) will appear in the notification title or message. Other tags will be displayed below the notification content.
All messages have a priority that defines how urgently your phone notifies you, depending on the configured vibration patterns, notification sounds, and visibility in the notification drawer or pop-over.
Set a delay for message delivery. Minimum delay is 10 seconds, maximum is 3 days.
Attach images or other files by uploading from a local file, camera, or image media source. When selecting a camera entity, a snapshot of the current view will be captured and attached to the notification.
Specify a custom filename for the attachment, including the file extension (for example, snapshot.jpg). If not provided, the filename defaults to attachment (for example, attachment.jpg).
Specify the address to forward the notification to, for example [email protected].
Phone number to call and read the message out loud using text-to-speech. Requires ntfy Pro and prior phone number verification.
Include an icon that will appear next to the text of the notification. Only JPEG and PNG images are supported.
Up to three actions (Open website/app, Send Android broadcast, Send HTTP request, or Copy to clipboard) can be added as buttons below the notification. Actions are executed when the corresponding button is tapped or clicked.
All parameters are optional. If message is left empty, the notification will use the default text: triggered. If priority is not specified, the default priority (3) will be used.
Check out the emoji reference for a full list of supported emoji shortcodes.
Action button options
Open a website or app
Select Open website/app to open a website or app when the button is clicked or tapped.
Send HTTP request
Select Send HTTP request to send an HTTP request when the button is clicked or tapped.
Send Android broadcast
Select Send Android broadcast to send an Android broadcast intent when the button is clicked or tapped.
Copy to clipboard
Select Copy to clipboard to copy a given value to the clipboard when the button is clicked or tapped.
Using this action in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this action as ntfy.publish. A basic example looks like this:
action: ntfy.publish
target:
entity_id: notify.mytopic
This sends a notification to the topic mytopic with the message content triggered.
Options in YAML
YAML sometimes provides additional options for more complex use cases that are not available through the UI.
Add tags or emojis to the notification. A list of strings representing tags or emoji codes.
The priority of the notification (1 = minimum, 2 = low, 3 = default, 4 = high, 5 = maximum).
Set a delay for message delivery. The minimum delay is 10 seconds, and the maximum delay is 3 days.
Action button options in YAML
Action view
Action http
Action broadcast
Enter broadcast to send an Android broadcast intent when the button is clicked or tapped.
Android intent to send when the broadcast action is triggered. Defaults to io.heckel.ntfy.USER_ACTION.
Action copy
Targets of the action
This action requires a target. The target is the object of the action. You can point the action at a single entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], a device, an area, a floor, or a label, and Home Assistant will run the action on every matching notify entity behind that target.
-
Entity: one specific notify entity, such as
notify.living_room. - Device: every notify entity that belongs to a device.
- Area: every notify entity in a room or area.
- Floor: every notify entity on a floor.
- Label: every notify entity that shares a label.
You can also select different target types in one action. For example, you can add a specific entity and an area as targets in the same action to run the action on both of them at once.
Try it yourself
Ready to test this? Open Developer tools > Actions, search for this action, fill in the fields, and select Perform action. You see what happens on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] without writing a line of YAML.
More examples
Real scenarios where this action shows up in automations and scripts. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Action: send a notification with a camera snapshot
You can send a notification with a camera snapshot, for example when someone rings the doorbell.
- Action: ntfy: Publish notification
- Target: ntfy topic
YAML example for a notification with a camera snapshot
action: ntfy.publish
target:
entity_id: notify.mytopic
data:
title: Someone is at the door
attach_file:
media_content_id: media-source://camera/camera.demo_camera
media_content_type: application/vnd.apple.mpegurl
filename: camera-snapshot.jpg
tags:
- bellhop_bell
Action: send a dead man’s switch notification
This action sends a notification that will only be delivered after a specified delay, acting as a so-called dead man’s switch.
To reset the timer (for example, after a successful daily check-in), you must send the notification again. This cancels the previously scheduled notification and starts a new 24-hour countdown.
- Action: ntfy: Publish notification
- Target: ntfy topic
YAML example for a dead man’s switch
action: ntfy.publish
target:
entity_id: notify.mytopic
data:
title: "Dead Man's Switch Activated"
message: "I haven't checked in for 24 hours. Please check on me."
priority: 5
delay:
hours: 24
sequence_id: "dead-mans-switch-check-in"
tags:
- warning
- skull
Action: send a notification to open a URL
This action sends a notification with an action button that, when tapped, opens a specific URL. For example, you can send an alert that includes a direct link to a relevant dashboard or camera feed.
- Action: ntfy: Publish notification
- Target: ntfy topic
YAML example for a notification with a button to open a URL
action: ntfy.publish
target:
entity_id: notify.mytopic
data:
message: "The garage door has been open for 10 minutes."
actions:
- type: view
label: "View Garage Camera"
url: "http://homeassistant.local/lovelace/garage"
clear: true
Action: send a notification to trigger a webhook
This action sends a notification that can trigger a webhook or another automation via an HTTP request. For example, you can create a “Party Mode” button that, when tapped, tells Home Assistant to run a script.
- Action: ntfy: Publish notification
- Target: ntfy topic
YAML example for a notification with a button to trigger a webhook
action: ntfy.publish
target:
entity_id: notify.mytopic
data:
message: "The party is starting!"
actions:
- type: http
label: "Start Party Mode"
url: "http://homeassistant.local/api/webhook/party-mode-webhook"
method: "POST"
Action: send a notification to copy text to the clipboard
This action sends a notification that allows you to copy a value to the clipboard. This is useful for sharing temporary information like guest Wi-Fi passwords or access codes.
- Action: ntfy: Publish notification
- Target: ntfy topic
YAML example for a notification with a copy to clipboard button
action: ntfy.publish
target:
entity_id: notify.mytopic
data:
title: "Guest Wi-Fi Password"
message: "Here is the guest Wi-Fi password for today."
actions:
- type: copy
label: "Copy Password"
value: "GuestPass1234!"
Action: send a notification to start sleep tracking
This action sends a notification that can trigger an Android broadcast intent to start sleep tracking in Sleep as Android.
- Action: ntfy: Publish notification
- Target: ntfy topic
YAML example for a notification with a button to trigger an Android broadcast
action: ntfy.publish
target:
entity_id: notify.mytopic
data:
message: "Time for bed?"
actions:
- type: broadcast
label: "Start sleep tracking"
intent: "com.urbandroid.sleep.START_SLEEP_TRACK"
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.
Related actions
These actions work well alongside this one:
-
Dismiss notification: Dismiss a message from a ntfy topic by marking it as read.
-
Delete notification: Delete a notification from a ntfy topic.