I\'m using the Javascript client API with my app and I\'m trying to get unread mails from the primary inbox.
If I use the INBOX and UNREAD names when requesting the lab
You could try "in:unread category:primary "
You can try this "in:inbox is:unread -category:(promotions OR social)" as a value for q parameter in messages.list. I tried this in API explorer, and it gave correct results.
I have 4 "UNREAD" mails(or Threads) in my inbox, and response is:
200 OK
{
"messages": [
{
"id": "14aea080215aa680", --- Thread 1
"threadId": "14aea080215aa680"
},
{
"id": "14ae8e25e92657e3", --- Thread 2
"threadId": "14ae8e25e92657e3"
},
{
"id": "14ae5e7a8bb1bc2f",-- Thread 3
"threadId": "14ae433c5ae8de64"
},
{
"id": "14ae439fd8cd3726",-- Same thread 3 with different message id
"threadId": "14ae433c5ae8de64"
},
{
"id": "14ae433c5ae8de64",-- Same thread 3 with different message id
"threadId": "14ae433c5ae8de64"
},
{
"id": "14ae33d8431a06f3",-- Thread 4
"threadId": "14ae33d8431a06f3"
}
],
"resultSizeEstimate": 6
}
Try also this "in:inbox is:unread category:primary"