Mark a chat as read
Receive read receipts via webhooks
Subscribe toreceipt.read events to know when someone has read your messages:
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Mark conversations as read and track read status
import { createClient } from "@messages-dev/sdk";
const client = createClient();
await client.sendReadReceipt({
from: "+15551234567",
to: "+15559876543",
});
curl -X POST "https://api.messages.dev/v1/receipts" \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"from": "+15551234567",
"to": "+15559876543"
}'
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);
});
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)}`);
}
curl "https://api.messages.dev/v1/receipts?from=+15551234567&to=+15559876543" \
-H "Authorization: Bearer sk_live_..."
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);
});