You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @skhwc-cnchung — great question. The GET /api/sessions/{sessionId}/messages endpoint returns both inbound and outbound messages from local history; it does not filter by direction. If you're only seeing outbound, one of these is most likely the cause:
1. You're filtering by from=<your number> instead of chatId=<contact>
The endpoint accepts these query params:
chatId — every message in a conversation (both directions)
from — only messages where the sender matches (so from=<your session number> naturally returns only outbound)
limit, offset — pagination (default 50, max 100)
To get the full back-and-forth with a contact, filter by chatId:
The endpoint resolves both JID dialects (@c.us vs @s.whatsapp.net) and LID mappings, so a phone number will match even if the underlying rows are stored under a LID.
2. Inbound messages aren't being persisted in your version
In older versions, inbound messages were not always written to local history. As of v0.10.0+, inbound messages are persisted to the same table as outbound sends (with direction = INCOMING), so they appear in this endpoint's results.
If you're on an older version, upgrade to the latest (v0.10.2) and you'll see both directions:
docker pull ghcr.io/rmyndharis/openwa:latest
docker compose up -d
3. Real-time inbound via webhook
If you want inbound messages pushed to your app the moment they arrive (instead of polling history), set up a webhook — OpenWA emits message.received events you can subscribe to. See the Webhooks section in the dashboard.
Let me know which of those fits your case and I can help further. 🙂
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
[/api/sessions/{sessionId}/messages]
Get message history for a session <- just only get outbound message, cannot get inbound.
Would you mind tell me? Thanks!
All reactions