When you reply to a conversation — on the web, in the app or through the API — the customer's earlier messages now count as read, so its unread number drops for the whole team.
On the web, a message that arrives in the conversation you have open is read at once, and coming back to the tab reads what came in meanwhile. The app does the same for the conversation on screen, and when you return to the app.