List messages in a WhatsApp conversation
/v1/whatsapp/conversations/{conversation_id}/messagesconst messages = await bird.whatsapp.conversations.listMessages("wacv_01krdgeqcxet5s7t44vh8rt9mg", {
direction: "inbound",
});
for (const message of messages.data ?? []) {
console.log(message.id, message.created_at);
}messages = client.whatsapp.conversations.list_messages("wacv_01krdgeqcxet5s7t44vh8rt9mg", direction="inbound")
for message in messages.data or []:
print(message.id, message.created_at)for message, err := range client.Whatsapp.Conversations.ListMessages(context.Background(), "wacv_01krdgeqcxet5s7t44vh8rt9mg", bird.WhatsappConversationsListMessagesParams{
Direction: "inbound",
}) {
if err != nil {
log.Fatal(err)
}
fmt.Println(message.Id, message.CreatedAt)
}foreach ($bird->whatsapp->conversations->listMessages('wacv_01krdgeqcxet5s7t44vh8rt9mg', ['direction' => 'inbound']) as $message) {
echo $message->getId(), ' ', $message->getCreatedAt()?->format(DATE_ATOM), PHP_EOL;
}bird whatsapp conversations list-messages <conversation-id>curl -X GET "https://us1.platform.bird.com/v1/whatsapp/conversations/{conversation_id}/messages" \
-H "Authorization: Bearer $TOKEN" \
--url-query "limit=25"{
"data": [
{
"id": "wam_01krdgeqcxet5s7t44vh8rt9mh",
"direction": "outbound",
"from": {
"phone_number": "+15550001234"
},
"to": {
"phone_number": "+15550001111",
"bsuid": "US.13491208655302741918"
},
"text": {
"body": "Yes. Reply with the new address and we will update it."
},
"status": "delivered",
"created_at": "2026-09-23T10:37:12Z",
"sent_at": "2026-09-23T10:37:13Z",
"delivered_at": "2026-09-23T10:37:14Z"
},
{
"id": "wam_01krdgeqcxet5s7t44vh8rt9mg",
"direction": "inbound",
"from": {
"phone_number": "+15550001111",
"bsuid": "US.13491208655302741918",
"display_name": "Jamie Rivera"
},
"to": {
"phone_number": "+15550001234"
},
"text": {
"body": "Can I change the delivery address on my order?"
},
"status": "received",
"created_at": "2026-09-23T10:35:00Z"
}
],
"next_cursor": null,
"prev_cursor": null,
"refresh_cursor": "eyJ2IjoxLCJzIjoiXCIyMDI2LTA1LTI1VDE0OjAzOjEwWlwiIiwiaSI6IjAxOTJmM2IxLTRjN2UtN2EyYi05ZDYxLThmM2E1YzJlN2I0MCJ9"
}
Returns the messages in one conversation, newest first, as a cursor-paginated list. They are the same messages the WhatsApp message list returns, already narrowed to this conversation's number and contact, so each one carries the content object it was built from and its current delivery status.
Filter by direction to read only what the contact sent or only what was sent to them. Pass the response's next_cursor back as starting_after for the next page.
Messages are retained for 30 days. When a conversation's last message expires, the conversation and its events are deleted too, and the conversation returns 404. The contact's next message starts a new conversation with a new ID. There is no way to read messages older than the window.
Parameter
conversation_idstringConversation identifier. Starts with wacv_.
Parameter Kueri
directionstringReturn only messages the contact sent (inbound) or only messages sent to them (outbound). Omit for both.
Possible values: outbound, inbound
limitintegerMaximum number of items to return per page.
starting_afterstringCursor from the next_cursor field of a previous list response. Returns items immediately after the cursor position in the current sort order.
ending_beforestringCursor from the prev_cursor or refresh_cursor field of a previous list response. Returns items immediately before the cursor position in the current sort order. prev_cursor returns the preceding page. refresh_cursor anchors at the first row of that response, which on a newest-first sort is how to fetch the items that have appeared since.
Payload Respons
next_cursorCursor for the next page. Pass back as starting_after to advance forward. null when no next page exists.
prev_cursorCursor for the previous page. Pass back as ending_before to step backward. null when no previous page exists.
refresh_cursorRefresh anchor, the first row of this response. Pass back as ending_before to fetch what precedes it in the current sort order. On a newest-first sort those are the items that have appeared since; on any other sort they are the items that sort earlier, so refreshing such a list means re-fetching it instead. Non-null whenever data is non-empty; null only on an empty page. Distinct from prev_cursor.
Sumber daya terkait
Lanjutkan dengan dokumentasi, panduan, dan contoh untuk topik ini.