> ## 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.

# Read Receipts

> Mark conversations as read and track read status

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

<CodeGroup>
  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
  import { createClient } from "@messages-dev/sdk";

  const client = createClient();

  await client.sendReadReceipt({
    from: "+15551234567",
    to: "+15559876543",
  });
  ```

  ```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
  curl -X POST "https://api.messages.dev/v1/receipts" \
    -H "Authorization: Bearer sk_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "from": "+15551234567",
      "to": "+15559876543"
    }'
  ```
</CodeGroup>

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:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
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:

<CodeGroup>
  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
  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)}`);
  }
  ```

  ```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
  curl "https://api.messages.dev/v1/receipts?from=+15551234567&to=+15559876543" \
    -H "Authorization: Bearer sk_live_..."
  ```
</CodeGroup>

## Common pattern: auto-read on webhook

Automatically mark conversations as read when you process incoming messages:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
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);
});
```
