Skip to main content
Read receipts let the other person know you’ve seen their message. You can send them programmatically and receive them via webhooks when someone reads your message.

Mark a chat as read

import { createClient } from "@messages-dev/sdk";

const client = createClient();

await client.sendReadReceipt({
  from: "+15551234567",
  to: "+15559876543",
});
This marks the entire conversation as read. The other person will see a “Read” indicator under their last message.

Receive read receipts via webhooks

Subscribe to receipt.read events to know when someone has read your messages:
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 === "receipt.read") {
    console.log(`${event.data.handle} read the chat at ${new Date(event.data.last_read_at)}`);
  }

  res.sendStatus(200);
});

List read receipts

Check the read status of a chat:
const receipts = await client.listReadReceipts({
  from: "+15551234567",
  to: "+15559876543",
});

for (const receipt of receipts.data) {
  console.log(`${receipt.handle} last read at ${new Date(receipt.lastReadAt)}`);
}

Common pattern: auto-read on webhook

Automatically mark conversations as read when you process incoming messages:
import { createClient, verifyWebhook } from "@messages-dev/sdk";

const client = createClient();

app.post("/webhooks", async (req, res) => {
  const event = await verifyWebhook(
    req.body,
    req.headers["x-webhook-signature"],
    "your_webhook_secret",
  );

  if (event.event === "message.received") {
    await handleMessage(event.data);

    await client.sendReadReceipt({
      from: event.data.line_id,
      to: event.data.sender,
    });
  }

  res.sendStatus(200);
});