الأكاديمية ← قنوات المراسلةتوثيق رسمي · إرشاد عربي

إشعارات ntfy

ntfy

متوسط إلى متقدم6 دقائق قراءةالدرس 334 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

بوابة المراسلة: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية. الوكيل الذي تصله من هاتفك تستعمله فعلًا. الذي يحتاج فتح الحاسوب تنساه بعد أسبوع. ستستعمل هنا hermes gateway setup وhermes send، والقراءة نحو 6 دقائق. انتبه: افتح القناة لنفسك فقط في البداية عبر قائمة سماح. القناة المفتوحة تعني أن أي شخص يراسل وكيلك.

10أقسام
9أمثلة برمجية
1جداول
4أوامر
976كلمة من المصدر
ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما بوابة المراسلة ولماذا قد تحتاجه.
  • تنفّذ hermes gateway setup وhermes send وتفهم ما يحدث بعدها.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تضبط NTFY_TOPIC في المكان الصحيح.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

الأوامر
  • hermes gateway setup
  • hermes send
  • hermes gateway restart
  • hermes send ntfy:alerts-channel
متغيرات البيئة
  • NTFY_TOPIC
  • NTFY_ALLOWED_USERS
  • NTFY_HOME_CHANNEL
  • NTFY_TOKEN
  • NTFY_SERVER_URL
  • NTFY_MARKDOWN
  • NTFY_PUBLISH_TOPIC
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Prerequisites
  2. 02Configure Hermes
  3. 03Identity model — read this before deploying
  4. 04Quick start — talk to your agent from your phone
  5. 05Using ntfy with cron jobs
  6. 06Self-hosting ntfy
  7. 07Markdown formatting
  8. 08Outgoing-only setup (notifications without inbound)
  9. 09Limits
  10. 10Troubleshooting
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

ntfy ↗ is a simple HTTP-based pub-sub notification service. It works with the free public server at ntfy.sh or any self-hosted instance, and supports any client that can make HTTP requests — phones, browsers, scripts, watches.

ntfy makes a great lightweight push channel for Hermes: subscribe to a topic from the ntfy mobile app ↗, send messages to the topic to talk to the agent, get the response back on your phone.

Run hermes gateway setup and pick ntfy for a guided walk-through.

Prerequisites

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية.

  • A topic name (any unique string — hermes-myname-2026 works fine)
  • The ntfy mobile app ↗ installed and subscribed to that topic
  • Optional: a self-hosted ntfy server, or an ntfy.sh account token for private/reserved topics

That's it. No SDK, no daemon, no Node.js. The adapter uses httpx which is already a Hermes dependency.

Configure Hermes

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط. الأوامر هنا: hermes gateway setup.

Via setup wizard

Shellسطر واحد
hermes gateway setup

Select ntfy and follow the prompts.

Via environment variables

Add these to ~/.hermes/.env:

Text3 أسطر
NTFY_TOPIC=hermes-myname-2026
NTFY_ALLOWED_USERS=hermes-myname-2026
NTFY_HOME_CHANNEL=hermes-myname-2026
VariableRequiredDescription
NTFY_TOPICYesTopic to subscribe to (incoming messages)
NTFY_SERVER_URLOptionalServer URL (default: https://ntfy.sh) — point to a self-hosted ntfy for privacy
NTFY_TOKENOptionalBearer token (e.g. tk_xyz) or user:pass for Basic auth
NTFY_PUBLISH_TOPICOptionalDifferent topic for outgoing replies (defaults to NTFY_TOPIC)
NTFY_MARKDOWNOptionalSet true to send replies with X-Markdown: true header
NTFY_ALLOWED_USERSRecommendedComma-separated topic names allowed (treated as user IDs; see below)
NTFY_ALLOW_ALL_USERSOptionalSet true to allow every publisher — only safe for private topics with read tokens
NTFY_HOME_CHANNELOptionalDefault topic for cron / notification delivery
NTFY_HOME_CHANNEL_NAMEOptionalHuman label for the home channel

Identity model — read this before deploying

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط NTFY_ALLOWED_USERS، NTFY_TOKEN خارج المحادثة، في بيئة التشغيل.

ntfy has no native authenticated user identity. The title field on a published message is publisher-controlled and can be anything the sender wants. The Hermes adapter does NOT use title for authorization — it would let any publisher who knows the topic spoof an allowed user.

Instead, the topic name itself is the identity. Every message published to the topic is treated as coming from the same logical user (the topic). NTFY_ALLOWED_USERS is therefore typically just the topic name itself — a single-entry allowlist that gates the whole channel.

This means anyone who knows the topic can talk to the agent. To make that a real trust boundary:

  • Self-host ntfy and lock the topic down with Access Control ↗. Only authorized clients with the read/write token can publish.
  • Or use a private topic on ntfy.sh (reserved topics ↗ require an account) and protect it with a NTFY_TOKEN.
  • Or pick a long, unguessable topic name (hermes-7d4f9c8b-2026) and treat it as the shared secret. This is the lightest setup but the topic name leaks via any logs or screenshots.

In all cases, do not put sensitive data through ntfy unless the underlying topic is access-controlled.

Quick start — talk to your agent from your phone

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes gateway restart.

  1. Pick a topic name: hermes-myname-2026
  2. On your phone: install the ntfy app ↗, tap +, enter hermes-myname-2026
  3. On the host:
Shell3 أسطر
   echo 'NTFY_TOPIC=hermes-myname-2026' >> ~/.hermes/.env
   echo 'NTFY_ALLOWED_USERS=hermes-myname-2026' >> ~/.hermes/.env
   hermes gateway restart
  1. From the ntfy app, send a message to the topic. The agent's reply lands as a push notification.

Using ntfy with cron jobs

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. الأوامر هنا: hermes send، hermes send ntfy:alerts-channel. تضبط NTFY_HOME_CHANNEL خارج المحادثة، في بيئة التشغيل.

Once NTFY_HOME_CHANNEL is set, cron jobs can deliver to ntfy:

Python6 أسطر
cronjob(
    action="create",
    schedule="every 1h",
    deliver="ntfy",          # uses NTFY_HOME_CHANNEL
    prompt="Check for alerts and summarise."
)

Or target a specific topic explicitly via the cron job's deliver: field, or from a shell script with the hermes send CLI:

Shellسطر واحد
hermes send ntfy:alerts-channel "Done!"

This works even when the cron runs out-of-process from the gateway — the plugin registers a standalone_sender_fn that opens its own HTTP connection.

Self-hosting ntfy

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط NTFY_SERVER_URL، NTFY_TOPIC خارج المحادثة، في بيئة التشغيل.

If you want full control:

Shell6 أسطر
# Docker
docker run -p 80:80 -it binwiederhier/ntfy serve

# Native
go install heckel.io/ntfy/v2@latest
ntfy serve

Then point Hermes at it:

Text3 أسطر
NTFY_SERVER_URL=https://ntfy.mydomain.com
NTFY_TOPIC=hermes
NTFY_TOKEN=tk_abc123  # if you've set up access control

Self-hosting gives you topic access control, message persistence policies, attachments, and emoji tags. See the ntfy server docs ↗.

Markdown formatting

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط NTFY_MARKDOWN خارج المحادثة، في بيئة التشغيل.

ntfy clients render markdown when the publisher sets the X-Markdown: true header. To enable for outgoing Hermes replies:

Textسطر واحد
NTFY_MARKDOWN=true

Or in config.yaml:

YAML4 أسطر
platforms:
  ntfy:
    extra:
      markdown: true

The mobile app supports a subset of CommonMark — bold, italic, lists, links, fenced code blocks. See ntfy's markdown docs ↗ for the exact set.

Outgoing-only setup (notifications without inbound)

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

If you only want Hermes to push notifications to ntfy (cron summaries, alerts) and never accept messages back, set both NTFY_TOPIC and NTFY_PUBLISH_TOPIC to the same value and skip NTFY_ALLOWED_USERS entirely. With no allowlist, the agent never responds to inbound messages — your phone gets the pushes, but the conversation is one-way.

Limits

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

  • Message size: ntfy caps message bodies at 4096 chars. Hermes truncates with a warning when this is exceeded.
  • No typing indicators: the protocol doesn't expose one; send_typing is a no-op.
  • No threads or attachments: ntfy is plain push notifications. Long replies stay in the message body, no thread fanout.
  • No native user identity: see the identity-model section above.

Troubleshooting

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا.

Auth failure / 401 — NTFY_TOKEN is wrong, or the token doesn't have publish/subscribe rights on this topic. The adapter halts its reconnect loop on 401 and the gateway runtime status will show fatal: ntfy_unauthorized. Fix the token and restart the gateway.

Topic not found / 404 — NTFY_TOPIC doesn't exist on the configured server. For ntfy.sh, topics are auto-created on first publish, so a 404 means you're pointed at a self-hosted server that doesn't have the topic provisioned. The adapter halts its reconnect loop with fatal: ntfy_topic_not_found.

Connected but no messages — Check that NTFY_ALLOWED_USERS includes the topic name itself. With ntfy's identity model, the topic IS the user; leaving the allowlist empty rejects everything.

Reconnects every 60s — The stream keepalive default is 55s; ntfy may have intermittent network issues. The adapter applies exponential backoff (2 → 5 → 10 → 30 → 60s) and resets to 0 once a stream stays alive ≥60s.

اختبار الفهم

4 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. في جدول هذا الدرس، ما «Required» المقابل لـ«NTFYHOMECHANNEL»؟
2. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
3. أي عنوان من التالي لا يظهر في هذا الدرس؟
4. أي مفتاح إعداد يظهر في أمثلة هذا الدرس؟