iMessage عبر Photon
Photon iMessage
ما هذه الصفحة، وماذا تحتوي.
بوابة المراسلة: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية. الوكيل الذي تصله من هاتفك تستعمله فعلًا. الذي يحتاج فتح الحاسوب تنساه بعد أسبوع. ستستعمل هنا hermes photon setup وhermes send، والقراءة نحو 7 دقائق. انتبه: افتح القناة لنفسك فقط في البداية عبر قائمة سماح. القناة المفتوحة تعني أن أي شخص يراسل وكيلك.
نتائج مأخوذة من هذه الصفحة، لا من قالب.
- تعرف ما بوابة المراسلة ولماذا قد تحتاجه.
- تنفّذ
hermes photon setupوhermes sendوتفهم ما يحدث بعدها. - تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
- تضبط
PHOTON_SIDECAR_DIRفي المكان الصحيح.
كما تظهر تمامًا داخل Hermes.
hermes photon setuphermes sendhermes pairing listhermes gateway setuphermes gateway starthermes photon statushermes pairing approve photonhermes photon install-sidecar
PHOTON_SIDECAR_DIRPHOTON_PROJECT_IDPHOTON_PROJECT_SECRETPHOTON_ALLOWED_USERSPHOTON_ALLOW_ALL_USERSPHOTON_REQUIRE_MENTIONPHOTON_MENTION_PATTERNS
انتقل مباشرة إلى ما تحتاجه.
بلا اختصار أو حذف.
النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.
Connect Hermes to iMessage through [Photon][photon], a managed service that handles the Apple line allocation and abuse-prevention layer so you don't have to run your own Mac relay.
The free tier uses Photon's shared iMessage line pool — different recipients may see different sending numbers, but each conversation stays stable. The paid Business tier gives every user the same dedicated number; the plugin supports both, and the free tier is the recommended starting point.
Architecture
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية.
Photon is a persistent-connection channel, like Discord or Slack — no webhook, no public URL, no signing secret to manage.
The spectrum-ts SDK holds a long-lived gRPC stream to Photon for
both directions. Because the SDK is TypeScript-only, Hermes runs it in a
small supervised Node sidecar and talks to it over loopback:
- Inbound — the sidecar consumes the SDK's
app.messagesgRPC stream and forwards each message to the Python adapter over a loopbackGET /inbound(NDJSON). The adapter dedupes and dispatches it to the agent, reconnecting automatically if the stream drops. - Outbound — replies are loopback POSTs to the sidecar, which calls
space.send(...)on the SDK.
The Python plugin starts, supervises, and shuts down the sidecar automatically.
Prerequisites
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
- A Photon account — sign up at [app.photon.codes][app]
- Node.js 18.17 or newer on PATH (
node --version) - A phone number that can receive iMessage (used to bind your account)
That's it — there is no public URL or tunnel to set up.
First-time setup
خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes photon setup، hermes gateway setup.
Either run the unified gateway wizard and pick Photon iMessage:
hermes gateway setup…or run the Photon setup directly (the wizard calls the same flow):
# Device-code login + project + user + sidecar deps, all in one
hermes photon setup --phone +15551234567The setup, in order:
- Device login (
client_id=photon-cli) — openshttps://app.photon.codes/for approval and stores the bearer token. - Finds or creates the
Hermes Agentproject on your account. - Enables Spectrum, reads the project's Spectrum id, and rotates the project secret.
- Registers your phone number as a Spectrum user — skipped if a user with that number already exists, so re-running is safe.
- Prints your assigned iMessage line — the number you text to reach your agent.
- Runs
npm installinside the plugin's sidecar directory. On read-only / immutable install trees (hosted Docker images, Podman, Nix) the sidecar automatically falls back to a writable mirror under~/.hermes/photon/sidecar; setPHOTON_SIDECAR_DIRto pin an explicit location.
Runtime credentials are written to ~/.hermes/.env
(PHOTON_PROJECT_ID = the Spectrum project id, PHOTON_PROJECT_SECRET),
the same place every other channel keeps its token. Management metadata
(device token, dashboard project id) lives in ~/.hermes/auth.json under
credential_pool.photon / credential_pool.photon_project.
Authorizing users
إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. الأوامر هنا: hermes pairing list، hermes pairing approve photon. تضبط PHOTON_ALLOWED_USERS، PHOTON_ALLOW_ALL_USERS خارج المحادثة، في بيئة التشغيل.
Photon uses the same authorization model as every other Hermes channel. Choose one approach:
DM pairing (default). When an unknown number messages your Photon line, Hermes replies with a pairing code. Approve it with:
hermes pairing approve photon <CODE>Use hermes pairing list to see pending codes and approved users.
Pre-authorize specific numbers (in ~/.hermes/.env):
PHOTON_ALLOWED_USERS=+15551234567,+15559876543Open access (dev only, in ~/.hermes/.env):
PHOTON_ALLOW_ALL_USERS=trueWhen PHOTON_ALLOWED_USERS is set, unknown senders are silently
ignored rather than offered a pairing code (the allowlist signals you
deliberately restricted access).
Require mentions in group chats
By default Hermes responds to every authorized DM and group message. To make group chats opt-in, enable mention gating (DMs still always work):
gateway:
platforms:
photon:
enabled: true
require_mention: trueWith require_mention: true, group-chat messages are ignored unless
they match a wake-word pattern. The defaults match Hermes and
@Hermes agent variants. For a custom agent name, set regex patterns:
gateway:
platforms:
photon:
require_mention: true
mention_patterns:
- '(?<![\w@])@?amos\b[,:\-]?'Both keys also accept env vars (PHOTON_REQUIRE_MENTION,
PHOTON_MENTION_PATTERNS). This is the same mention-gating model the
BlueBubbles iMessage channel uses.
Start the gateway
أوامر تكتبها في الطرفية. افهم ما يفعله الأمر قبل نسخه. الأوامر هنا: hermes gateway start.
hermes gateway startYou'll see something like:
[photon] connected — sidecar on 127.0.0.1:8789, streaming inbound over gRPCSend an iMessage to your assigned number and Hermes will reply.
Status & troubleshooting
قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا. الأوامر هنا: hermes photon setup، hermes photon status.
hermes photon statusPrints saved credentials, sidecar health, your registered number, and the
assigned iMessage line Hermes uses. When a Photon token and dashboard project
are available, status refreshes missing number rows from the dashboard
without provisioning new lines.
Photon iMessage status
──────────────────────
device token : ✓ stored
dashboard project : 3c90c3cc-0d44-4b50-...
spectrum project id : sp-...
project secret : ✓ stored
my number : +15551234567
assigned number : +16282679185
node binary : /usr/bin/node
sidecar deps : ✓ installedCommon issues:
sidecar deps : ✗ run hermes photon install-sidecar— Node is installed butspectrum-tsisn't. Run the suggested command.device token : ✗ missing— runhermes photon setupto log in.No iMessage line assigned yet— Spectrum is enabled but no line has been provisioned; re-runhermes photon setupor check the [dashboard][app].- Sidecar won't start — confirm
node --versionis 18.17+ and thathermes photon install-sidecarcompleted without errors.
Limits today
أوامر تكتبها في الطرفية. افهم ما يفعله الأمر قبل نسخه. الأوامر هنا: hermes send.
- Inbound attachments are metadata-only. Inbound events carry the filename + MIME type; the agent sees a marker but can't yet read the bytes. The SDK exposes attachment bytes via
content.read(), so this is a sidecar follow-up. - Outbound attachments are supported. Hermes sends images, voice notes, video, and documents through spectrum-ts'
attachment()/voice()content builders via the sidecar's/send-attachmentendpoint. Captions arrive as a separate iMessage bubble after the media. - Native polls are supported. Hermes sends poll content through spectrum-ts'
poll()builder via the sidecar's/send-pollendpoint. - Message effects are supported. Hermes sends text with native iMessage bubble/screen effects through spectrum-ts' iMessage
effect()builder via the sidecar's/send-effectendpoint. - Photon's free quotas: 5,000 messages per server per day, 50 new-conversation initiations per shared line per day. Increases available — email
help@photon.codes. - Cron and standalone sends need the gateway running. Out-of-process senders (cron jobs,
hermes send, the dashboard) reuse the sidecar the gateway spawned — they read its port/token from<hermes-home>/runtime/photon-sidecar.json, written once the sidecar passes its health check and removed when it stops. If a standalone send reports the gateway appears to be down, start (or restart) the gateway first. - Shared/free-tier lines can't initiate conversations with new targets. Photon-side policy: a shared line can only message a number after that number has texted the line first. A cron/standalone send to a brand-new recipient will be rejected by Photon even when Hermes is set up correctly — either have the recipient message the line once, or move to a dedicated line.
Env vars
جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.
| Variable | Default | Notes |
|---|---|---|
PHOTON_PROJECT_ID | from .env | Spectrum project id (the SDK's projectId); set by setup |
PHOTON_PROJECT_SECRET | from .env | Project secret; set by setup |
PHOTON_SIDECAR_PORT | 8789 | Loopback port for the sidecar control + inbound channel |
PHOTON_SIDECAR_AUTOSTART | true | Whether the adapter spawns the sidecar |
PHOTON_NODE_BIN | which node | Override the Node binary path |
PHOTON_HOME_CHANNEL | (unset) | Default space id for cron / notifications |
PHOTON_HOME_CHANNEL_NAME | (unset) | Human label for the home channel |
PHOTON_ALLOWED_USERS | (unset) | Comma-separated E.164 allowlist |
PHOTON_ALLOW_ALL_USERS | false | Dev only — accept any sender |
PHOTON_REQUIRE_MENTION | false | Require a wake word before responding in groups |
PHOTON_MENTION_PATTERNS | Hermes wake words | JSON list / comma / newline regex patterns for group mentions |
PHOTON_DASHBOARD_HOST | app.photon.codes | Override the dashboard / device-login host |
PHOTON_SPECTRUM_HOST | spectrum.photon.codes | Override the Spectrum API host |
[photon]: https://photon.codes/ [app]: https://app.photon.codes/
4 أسئلة إجاباتها كلها في هذه الصفحة.
كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.