index.gohtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. {{- /*gotype: heckel.io/ntfy/server.indexPage*/ -}}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>ntfy.sh | Send push notifications to your phone via PUT/POST</title>
  7. <link rel="stylesheet" href="static/css/app.css" type="text/css">
  8. <!-- Mobile view -->
  9. <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
  10. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  11. <meta name="HandheldFriendly" content="true">
  12. <!-- Mobile browsers, background color -->
  13. <meta name="theme-color" content="#317f6f">
  14. <meta name="msapplication-navbutton-color" content="#317f6f">
  15. <meta name="apple-mobile-web-app-status-bar-style" content="#317f6f">
  16. <!-- Favicon, see favicon.io -->
  17. <link rel="icon" type="image/png" href="static/img/favicon.png">
  18. <!-- Previews in Google, Slack, WhatsApp, etc. -->
  19. <meta property="og:type" content="website" />
  20. <meta property="og:locale" content="en_US" />
  21. <meta property="og:site_name" content="ntfy.sh" />
  22. <meta property="og:title" content="ntfy.sh | Send push notifications to your phone or desktop via PUT/POST" />
  23. <meta property="og:description" content="ntfy is a simple HTTP-based pub-sub notification service. It allows you to send desktop notifications via scripts from any computer, entirely without signup or cost. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy." />
  24. <meta property="og:image" content="/static/img/ntfy.png" />
  25. <meta property="og:url" content="https://ntfy.sh" />
  26. {{if .Topic}}
  27. <!-- Never index topic page -->
  28. <meta name="robots" content="noindex, nofollow" />
  29. {{end}}
  30. </head>
  31. <body>
  32. <nav id="header">
  33. <div id="headerBox">
  34. <img id="logo" src="static/img/ntfy.png" alt="logo"/>
  35. <div id="name">ntfy</div>
  36. <ol>
  37. <li><a href="docs/">Getting started</a></li>
  38. <li><a href="docs/subscribe/phone/">Android/iOS</a></li>
  39. <li><a href="docs/publish/">API</a></li>
  40. <li><a href="docs/install/">Self-hosting</a></li>
  41. <li><a href="https://github.com/binwiederhier/ntfy">GitHub</a></li>
  42. </ol>
  43. </div>
  44. </nav>
  45. <div id="main"{{if .Topic}} style="display: none"{{end}}>
  46. <h1>Send push notifications to your phone or desktop via PUT/POST</h1>
  47. <p>
  48. <b>ntfy</b> (pronounce: <i>notify</i>) is a simple HTTP-based <a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern">pub-sub</a> notification service.
  49. It allows you to send notifications to your phone or desktop via scripts from any computer,
  50. entirely <b>without signup, cost or setup</b>. It's also <a href="https://github.com/binwiederhier/ntfy">open source</a> if you want to run your own.
  51. </p>
  52. <div id="screenshots">
  53. <a href="static/img/screenshot-curl.png"><img src="static/img/screenshot-curl.png"/></a>
  54. <a href="static/img/screenshot-web-detail.png"><img src="static/img/screenshot-web-detail.png"/></a>
  55. <span class="nowrap">
  56. <a href="static/img/screenshot-phone-main.jpg"><img src="static/img/screenshot-phone-main.jpg"/></a>
  57. <a href="static/img/screenshot-phone-detail.jpg"><img src="static/img/screenshot-phone-detail.jpg"/></a>
  58. <a href="static/img/screenshot-phone-notification.jpg"><img src="static/img/screenshot-phone-notification.jpg"/></a>
  59. </span>
  60. </div>
  61. <h2 id="publish" class="anchor">Publishing messages</h2>
  62. <p>
  63. <a href="docs/publish/">Publishing messages</a> can be done via PUT or POST. Topics are created on the fly by subscribing or publishing to them.
  64. Because there is no sign-up, <b>the topic is essentially a password</b>, so pick something that's not easily guessable.
  65. </p>
  66. <p class="smallMarginBottom">
  67. Here's an example showing how to publish a message using a POST request (via <tt>curl -d</tt>):
  68. </p>
  69. <code>
  70. curl -d "Backup successful 😀" <span class="ntfyUrl">ntfy.sh</span>/mytopic
  71. </code>
  72. <p class="smallMarginBottom">
  73. There are <a href="docs/publish/">more features</a> related to publishing messages: You can set a
  74. <a href="docs/publish/#message-priority">notification priority</a>, a <a href="docs/publish/#message-title">title</a>,
  75. and <a href="docs/publish/#tags-emojis">tag messages</a>.
  76. Here's an example using some of them together:
  77. </p>
  78. <code>
  79. curl \<br/>
  80. &nbsp;&nbsp;-H "Title: Unauthorized access detected" \<br/>
  81. &nbsp;&nbsp;-H "Priority: urgent" \<br/>
  82. &nbsp;&nbsp;-H "Tags: warning,skull" \<br/>
  83. &nbsp;&nbsp;-d "Remote access to $(hostname) detected. Act right away." \<br/>
  84. &nbsp;&nbsp;<span class="ntfyUrl">ntfy.sh</span>/mytopic
  85. </code>
  86. <p>
  87. Here's what that looks like in the <a href="docs/subscribe/phone/">Android app</a>:
  88. </p>
  89. <figure>
  90. <img src="static/img/priority-notification.png" style="max-height: 200px"/>
  91. <figcaption>Urgent notification with pop-over</figcaption>
  92. </figure>
  93. <h2 id="subscribe" class="anchor">Subscribe to a topic</h2>
  94. <p>
  95. You can create and subscribe to a topic either <a href="docs/subscribe/phone/">using your phone</a>,
  96. in <a href="docs/subscribe/web/">this web UI</a>, or in your own app by <a href="docs/subscribe/api/">subscribing via the API</a>.
  97. </p>
  98. <h3 id="subscribe-phone" class="anchor">Subscribe from your phone</h3>
  99. <p>
  100. Simply get the app and start <a href="docs/publish/">publishing messages</a>. To learn more about the app,
  101. <a href="docs/subscribe/phone/">check out the documentation</a>.
  102. </p>
  103. <p>
  104. <a href="https://play.google.com/store/apps/details?id=io.heckel.ntfy"><img src="static/img/badge-googleplay.png"></a>
  105. <a href="https://f-droid.org/en/packages/io.heckel.ntfy/"><img src="static/img/badge-fdroid.png"></a>
  106. <a href="https://github.com/binwiederhier/ntfy/issues/4"><img src="static/img/badge-appstore.png"></a>
  107. </p>
  108. <p>
  109. Here's a video showing the app in action:
  110. </p>
  111. <figure>
  112. <video controls muted autoplay loop src="static/img/android-video-overview.mp4" style="max-width: 650px"></video>
  113. <figcaption>Sending push notifications to your Android phone</figcaption>
  114. </figure>
  115. <div id="subscribeBox">
  116. <h3 id="subscribe-web" class="anchor">Subscribe in this Web UI</h3>
  117. <p id="error"></p>
  118. <p>
  119. Subscribe to topics here and receive messages as <b>desktop notification</b>. Topics are not password-protected,
  120. so choose a name that's not easy to guess.
  121. </p>
  122. <form id="subscribeForm">
  123. <p>
  124. <b>Topic:</b><br/>
  125. <input type="text" id="topicField" autocomplete="off" placeholder="Topic name, e.g. phil_alerts" maxlength="64" pattern="[-_A-Za-z0-9]{1,64}" />
  126. <button id="subscribeButton">Subscribe</button>
  127. </p>
  128. <p id="topicsHeader"><b>Subscribed topics:</b></p>
  129. <ul id="topicsList"></ul>
  130. </form>
  131. <audio id="notifySound" src="static/sound/mixkit-message-pop-alert-2354.mp3"></audio>
  132. </div>
  133. <h3 id="subscribe-api" class="anchor">Subscribe using the API</h3>
  134. <p>
  135. There's a super simple API that you can use to integrate your own app. You can consume
  136. a <a href="docs/subscribe/api/#subscribe-as-json-stream">JSON stream</a>,
  137. an <a href="docs/subscribe/api/#subscribe-as-sse-stream">SSE/EventSource stream</a> (useful for web apps),
  138. as well as a <a href="docs/subscribe/api/#subscribe-as-raw-stream">plain text stream</a>.
  139. </p>
  140. <p class="smallMarginBottom">
  141. Here's an example for JSON. The <b>connection stays open</b>, so you can retrieve messages as they come in:
  142. </p>
  143. <code>
  144. $ curl -s <span class="ntfyUrl">ntfy.sh</span>/mytopic/json<br/>
  145. {"id":"SLiKI64DOt","time":1635528757,"event":"open","topic":"mytopic"}<br/>
  146. {"id":"hwQ2YpKdmg","time":1635528741,"event":"message","topic":"mytopic","message":"Hi!"}<br/>
  147. {"id":"DGUDShMCsc","time":1635528787,"event":"keepalive","topic":"mytopic"}<br/>
  148. ...
  149. </code>
  150. <p>
  151. Here's a short video demonstrating it in action:
  152. </p>
  153. <figure>
  154. <video controls muted autoplay loop src="static/img/android-video-subscribe-api.mp4" style="max-width: 650px"></video>
  155. <figcaption>Subscribing to the JSON stream with <tt>curl</tt></figcaption>
  156. </figure>
  157. <h3 id="docs" class="anchor">Check out the docs!</h3>
  158. <p>
  159. ntfy has so many more features and you can learn about all of them <a href="docs/">in the documentation</a>
  160. (I tried my very best to make it the best docs ever 😉, not sure if I succeeded, hehe).
  161. </p>
  162. <figure>
  163. <a href="docs/"><img width="100%" src="static/img/screenshot-docs.png"/></a>
  164. <figcaption>Check out the documentation</figcaption>
  165. </figure>
  166. <h3 id="free-software" class="anchor">100% open source &amp; forever free</h3>
  167. <p>
  168. I love free software, and I'm doing this because it's fun. I have no bad intentions, and I will
  169. never monetize or sell your information. This service will always stay
  170. <a href="https://github.com/binwiederhier/ntfy">free and open</a>.
  171. You can read more in the <a href="docs/faq/">FAQs</a> and in the <a href="docs/privacy/">privacy policy</a>.
  172. </p>
  173. <center id="ironicCenterTagDontFreakOut"><i>Made with ❤️ by <a href="https://heckel.io">Philipp C. Heckel</a></i></center>
  174. </div>
  175. <div id="detail"{{if not .Topic}} style="display: none"{{end}}>
  176. <div id="detailMain">
  177. <button id="detailCloseButton"><img src="static/img/close.svg"/></button>
  178. <h1><span id="detailTitle"></span></h1>
  179. <p class="smallMarginBottom">
  180. <b>ntfy</b> is a simple HTTP-based pub-sub notification service. This is a ntfy topic.
  181. To send notifications to it, simply PUT or POST to the topic URL. Here's an example using <tt>curl</tt>:
  182. </p>
  183. <code>
  184. curl -d "Backup failed" <span id="detailTopicUrl">ntfy.sh/topic</span>
  185. </code>
  186. <p id="detailNotificationsDisallowed">
  187. If you'd like to receive desktop notifications when new messages arrive on this topic, you have to
  188. <a href="#" onclick="return requestPermission()">grant the browser permission</a> to show notifications.
  189. Click the link to do so.
  190. </p>
  191. <p class="smallMarginBottom">
  192. <b>Recent notifications</b> ({{if .CacheDuration}}cached for {{.CacheDuration | durationToHuman}}{{else}}caching is disabled{{end}}):
  193. </p>
  194. <p id="detailNoNotifications">
  195. <i>You haven't received any notifications for this topic yet.</i>
  196. </p>
  197. <div id="detailEventsList"></div>
  198. </div>
  199. </div>
  200. <div id="lightbox" class="lightbox"></div>
  201. <script src="static/js/emoji.js"></script>
  202. <script src="static/js/app.js"></script>
  203. </body>
  204. </html>