Documentation Index
Fetch the complete documentation index at: https://messages.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
iMessage reactions are the emoji responses native to iMessage: love, like, dislike,
laugh, emphasize, and question. You can send them on any message and receive them
via webhooks.
Send a reaction
To react to a message, you need the message’s id or guid (both are returned
when listing messages) and the recipient’s handle:
import { createClient } from "@messages-dev/sdk";
const client = createClient();
await client.sendReaction({
from: "+15551234567",
to: "+15559876543",
messageId: "msg_abc123",
type: "love",
});
You can pass either a msg_ prefixed ID or a raw iMessage GUID as the message_id.
Reaction types
| Type | Emoji |
|---|
love | ❤️ |
like | 👍 |
dislike | 👎 |
laugh | 😂 |
emphasize | ‼️ |
question | ❓ |
Receive reactions via webhooks
Subscribe to reaction.added and reaction.removed events to get notified when
someone reacts to a message:
import { verifyWebhook } from "@messages-dev/sdk";
app.post("/webhooks", async (req, res) => {
const event = await verifyWebhook(
req.body,
req.headers["x-webhook-signature"],
"your_webhook_secret",
);
if (event.event === "reaction.added") {
console.log(`${event.data.sender} reacted with ${event.data.type}`);
}
if (event.event === "reaction.removed") {
console.log(`${event.data.sender} removed their ${event.data.type} reaction`);
}
res.sendStatus(200);
});
List reactions on a message
const reactions = await client.listReactions({
messageId: "msg_abc123",
});
for (const reaction of reactions.data) {
console.log(`${reaction.sender}: ${reaction.type} (${reaction.added ? "added" : "removed"})`);
}
Finding the message ID
Both the id and guid fields are returned on every message object. You can use
either one when sending reactions:
const messages = await client.listMessages({
from: "+15551234567",
to: "+15559876543",
limit: 1,
});
await client.sendReaction({
from: "+15551234567",
to: "+15559876543",
messageId: messages.data[0].id,
type: "love",
});