Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.photon.codes/docs/llms.txt

Use this file to discover all available pages before exploring further.

Both react and reply live directly on an incoming message. They no-op silently on platforms that don’t support the feature — no try/catch required. Spectrum also exports first-class reaction() and reply() content builders that you can pass directly to space.send(...) — the sugar methods on message delegate through the same send pipeline.

Reactions

await message.react("love");
Both forms are equivalent — message.react(emoji) delegates to space.send(reaction(emoji, message)) internally. The reaction string is platform-specific. For iMessage, use the built-in tapback constants:
import { imessage } from "spectrum-ts/providers/imessage";

await message.react(imessage.tapbacks.laugh);
reaction() rejects reaction messages as targets — reacting to a reaction throws at build time. Available tapbacks:
ConstantValue
imessage.tapbacks.love"love"
imessage.tapbacks.like"like"
imessage.tapbacks.dislike"dislike"
imessage.tapbacks.laugh"laugh"
imessage.tapbacks.emphasize"emphasize"
imessage.tapbacks.question"question"

Threaded replies

await message.reply("Replying to your message.");

await message.reply(
  "Here's the attachment you asked for:",
  attachment("/path/to/file.pdf"),
);
Both forms are equivalent — message.reply(content) wraps each content item in reply(content, message) and delegates to space.send(...) internally. On platforms with thread support (iMessage, WhatsApp Business), this sends a threaded reply. On platforms without, the call resolves as a no-op — the reply is not downgraded to a regular send. If you need guaranteed delivery, use space.send(...) instead. reply() cannot wrap reply, edit, reaction, group, or typing content — the builder throws at construction time.

Editing messages

const sent = await space.send("Draft");
await sent.edit("Final version");
edit() takes new content and the outbound message to rewrite. Edits are fire-and-forget — space.send(edit(...)) resolves to undefined. edit() cannot wrap edit, reply, reaction, group, or typing content.

When to use what

Want toUse
Send fresh content into the conversationspace.send(...)
Reply in-thread to a specific messagemessage.reply(...) or space.send(reply(...))
React to a specific messagemessage.react(emoji) or space.send(reaction(emoji, message))
Rewrite a sent messagemessage.edit(content) or space.send(edit(content, message))
space.send is the safe default — it works on every platform. The sugar methods (message.reply, message.react, message.edit) and the canonical content builders (reply(), reaction(), edit()) are interchangeable — they both route through the same send pipeline.