How to get unread messages using FQL?

后端 未结 4 1980
情话喂你
情话喂你 2021-01-19 06:16

I am trying to get the body and the sender of all unread inbox .

To get all conversation\'s threads with unread messages I used this query:

SELECT thre

4条回答
  •  悲&欢浪女
    2021-01-19 07:01

    This nested query you placed

    SELECT sender,body FROM unified_message WHERE thread_id IN (SELECT thread_id FROM unified_thread WHERE folder = 'inbox' AND unread=1) AND unread=1

    should work. If it doesn't, consider filing a bug.

    Breaking it down,

    SELECT thread_id FROM unified_thread WHERE folder = 'inbox' AND unread=1

    Should give you the thread ids for threads with unread messages. The only catch here is that unified_thread doesn't necessarily return all threads even with LIMITapplied. So what you did here was good (as long as the unread response set is small enough)

    If at this point, the numbers aren't matching what you have, it doesn't make sense to move further in the query. File a bug.

    The larger query

    SELECT sender,body FROM unified_message WHERE thread_id IN (SELECT thread_id FROM unified_thread WHERE folder = 'inbox' AND unread=1) AND unread=1

    Checks all messages within the thread, so as long as your thread ids are valid and correctly counted then there is nothing to worry about here.

    Ensure you are getting the correct count of unread threads first If not, as I said before, file a bug.

    So that with this query

    SELECT thread_id, participants, link FROM unified_thread WHERE folder = 'inbox' AND unread

    Cross check that the participants and links match what you have in your inbox.

提交回复
热议问题