Loading...
Loading...
Read the inbox — list conversation threads, fetch their messages, mark them read, and reply from the right sender.
npx skill4agent add zavudev/zavu-skills conversationsGET /v1/messageschannels| Field | Meaning |
|---|---|
| Thread ID. Same value as |
| The key the thread is filed under. Not always a phone number — see below. |
| The contact, when resolved. Absent on group threads. |
| Every channel this thread has carried. |
| Denormalized preview ( |
| Sender that last handled the thread. Pass it back as |
| Inbound messages not yet marked read. |
| |
| Present on group chats: |
US.13491208655302741918<id>@g.uschannelsgroup| Method | Path | Purpose |
|---|---|---|
| | List threads, most recently active first. |
| | One thread. |
| | Messages in the thread, newest first. |
| | Reset |
curl "https://api.zavu.dev/v1/conversations?limit=25" \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"senderIdchannelcurl "https://api.zavu.dev/v1/conversations?senderId=sender_12345&channel=whatsapp" \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"const res = await fetch("https://api.zavu.dev/v1/conversations?limit=25", {
headers: { Authorization: `Bearer ${process.env.ZAVUDEV_API_KEY}` },
});
const { items, nextCursor } = await res.json();search+1 (555) 123-456715551234567curl "https://api.zavu.dev/v1/conversations?search=%2B56912345678" \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"
# by email, by its local part, or by group name
curl "https://api.zavu.dev/v1/conversations?search=maria" \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"marmaria@example.com+1555+155512345674567searchsearchsearchsearchsenderIdchannelcursorconst params = new URLSearchParams({ search: "+56912345678", channel: "whatsapp" });
const res = await fetch(`https://api.zavu.dev/v1/conversations?${params}`, {
headers: { Authorization: `Bearer ${process.env.ZAVUDEV_API_KEY}` },
});
const { items } = await res.json();nextCursorcursornextCursornullasync function allConversations() {
const out = [];
let cursor: string | undefined;
do {
const url = new URL("https://api.zavu.dev/v1/conversations");
url.searchParams.set("limit", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.ZAVUDEV_API_KEY}` },
});
const page = await res.json();
out.push(...page.items);
cursor = page.nextCursor ?? undefined;
} while (cursor);
return out;
}channellimitnextCursornextCursornulldirectioninboundoutboundstatusdeliveredtocontactIdentifierfromfor (const m of items) {
const mine = m.direction === "outbound";
console.log(`${mine ? "→" : "←"} ${m.text}`);
}curl "https://api.zavu.dev/v1/conversations/$CONV_ID/messages?limit=50" \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"MessageGET /v1/messagescurl -X POST "https://api.zavu.dev/v1/conversations/$CONV_ID/read" \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"POST /v1/messages/{messageId}/typingPOST /v1/messagessenderIdZavu-Senderconst conv = await getConversation(conversationId);
await zavu.messages.send({
to: conv.contactIdentifier,
channel: conv.lastMessage.channel,
text: "Thanks — shipping today.",
"Zavu-Sender": conv.senderId,
});whatsapp_window_closedwhatsapp-templateschannelsGET /v1/senders/{senderId}message.inbounddata.conversationIdnulldata.conversationIdconversation.newGET /v1/messages/{messageId}conversationIdconversation.idmessage.inboundmessage.sentmessage.deliveredmessage.readmessage.failedconversation.newGET /v1/conversationswebhook-setup| Trap | Reality |
|---|---|
Treating | It can be a BSUID, chat ID, or group JID. |
| Building a cursor | Cursors are opaque; only echo |
| Stopping pagination on a short page | The |
Expecting | Absent on group threads and unresolved contacts. |
Expecting | It only clears your own counter. |
Assuming | It is |