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:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation or script, or select Create automation > Create new automation.
  3. 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.
  4. In the Then do section, select Add action.
  5. From the search box, search for and select ntfy: Publish notification.
  6. Under Targets, select the topics you want to notify (see Targets).
  7. Optional: Customize message priority, incorporate emojis, or add interactive elements like URLs, attachments, and action buttons.
  8. Select Save.

Options in the UI

Title (Optional)

Title for your notification message.

Message (Optional)

Your notification message. Defaults to the string triggered if no value is provided.

Format as Markdown (Optional)

Enable Markdown formatting for the message body. See the Markdown guide for syntax details.

Tags/Emojis (Optional)

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.

Message priority (Optional)

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.

Click URL (Optional)

URL that is opened when the notification is clicked.

Delay delivery (Optional)

Set a delay for message delivery. Minimum delay is 10 seconds, maximum is 3 days.

Attachment URL (Optional)

Attach images or other files by URL.

Attach local file (Optional)

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.

Attachment filename (Optional)

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).

Forward to email (Optional)

Specify the address to forward the notification to, for example [email protected].

Phone call (Optional)

Phone number to call and read the message out loud using text-to-speech. Requires ntfy Pro and prior phone number verification.

Icon URL (Optional)

Include an icon that will appear next to the text of the notification. Only JPEG and PNG images are supported.

Action buttons (Optional)

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.

Sequence ID (Optional)

Enter a message or sequence ID to update an existing notification, or specify a sequence ID to reference later when updating, clearing (mark as read and dismiss), or deleting a notification.

Note

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.

Tip

Check out the emoji reference for a full list of supported emoji shortcodes.

Action button options

Open a website or app
Action type (Required)

Select Open website/app to open a website or app when the button is clicked or tapped.

Label (Required)

Label of the action button in the notification.

URL (Required)

URL to open when action is tapped.

Clear (Optional)

Clear notification after action button is tapped.

Send HTTP request
Action type (Required)

Select Send HTTP request to send an HTTP request when the button is clicked or tapped.

Label (Required)

Label of the action button in the notification.

URL (Required)

URL to which the HTTP request will be sent.

HTTP method (Optional)

HTTP method to use for request, default is POST.

HTTP headers (Optional)

HTTP headers to pass in request (key-value pairs).

HTTP body (Optional)

Payload to send in the HTTP body.

Clear (Optional)

Clear notification after action button is tapped.

Send Android broadcast
Action type (Required)

Select Send Android broadcast to send an Android broadcast intent when the button is clicked or tapped.

Label (Required)

Label of the action button in the notification.

Intent (Optional)

Android intent name. Defaults to io.heckel.ntfy.USER_ACTION.

Intent extras (Optional)

Android intent extras (key-value pairs).

Clear (Optional)

Clear notification after action button is tapped.

Copy to clipboard
Action type (Required)

Select Copy to clipboard to copy a given value to the clipboard when the button is clicked or tapped.

Label (Required)

Label of the action button in the notification.

Value (Required)

Value to copy to the clipboard.

Clear (Optional)

Clear notification after action button is 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:

ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
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.

title string

Title for your notification message.

message string

Your notification message. Defaults to the string triggered if no value is provided.

markdown boolean

Set to true to enable Markdown formatting for the message body.

tags list

Add tags or emojis to the notification. A list of strings representing tags or emoji codes.

priority integer

The priority of the notification (1 = minimum, 2 = low, 3 = default, 4 = high, 5 = maximum).

click string

URL that is opened when the notification is clicked.

delay map

Set a delay for message delivery. The minimum delay is 10 seconds, and the maximum delay is 3 days.

attach string

Attach images or other files by URL.

attach_file map

Attach images or other files by uploading from a local file or camera media source.

filename string

Custom filename for the attachment, including the file extension.

email string

The email address to forward the notification to.

call string

Phone number to call and read the message out loud using text-to-speech.

icon string

URL of an icon that will appear next to the text of the notification.

action list

Up to three actions (view, broadcast, http, or copy) can be added as buttons below the notification. Actions are executed when the corresponding button is tapped or clicked.

sequence_id string

A message or sequence ID to update an existing notification, or to reference later when updating, clearing, or deleting a notification.

Action button options in YAML

Action view
type string Required

Enter view to open a website or app when the button is clicked or tapped.

label string Required

Label of the action button in the notification.

url string Required

Label of the action button in the notification.

clear boolean

Clear notification after action button is tapped.

Action http
type string Required

Enter http to send an HTTP request when the button is clicked or tapped.

label string Required

Label of the action button in the notification.

url string Required

URL to which the HTTP request will be sent.

method string

HTTP method to use for request, default is POST.

headers map

Additional HTTP headers as key-value pairs to send with the HTTP request.

body string

The body of the HTTP.

clear boolean

Clear notification after action button is tapped.

Action broadcast
type string Required

Enter broadcast to send an Android broadcast intent when the button is clicked or tapped.

label string Required

Label of the action button in the notification.

intent string

Android intent to send when the broadcast action is triggered. Defaults to io.heckel.ntfy.USER_ACTION.

extras map

Extras to include in the intent as key-value pairs.

clear boolean

Clear notification after action button is tapped.

Action copy
type string Required

Enter copy to copy a given value to the clipboard when the button is clicked or tapped.

label string Required

Label of the action button in the notification.

value string Required

Value to copy to the clipboard.

clear boolean

Clear notification after action button is tapped.

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.

Tip

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
ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
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
ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
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
ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
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
ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
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
ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
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
ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
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.

Tip

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: