Search code examples
facebook-graph-api

Facebook graph API mark as spam and filter conversation


In my messenger app, I need to block spams, and filter out when I call conversation list. Is this possible with graph API? How can I filter out the ones which are marked as spam?

`https://graph.facebook.com/${version}/${PAGE_ID}/conversations?${queryParam}`

Solution

  • You can request the conversations from within a specific folder only, https://developers.facebook.com/docs/graph-api/reference/conversation/#folders

    Folder. Description
    inbox Messages in your inbox
    other
    page_done Messages marked as Done that are no longer in your Page's main inbox. These messages are no longer visible in your inbox.
    pending Messages in your pending folder
    spam. Messages marked as Spam. These messages are no longer visible in your inbox but have not been deleted.

    You can specify the folder name after conversations edge, i.e. https://graph.facebook.com/${version}/${PAGE_ID}/conversations/inbox

    I don't know if you can specify multiple folders at once though, should you need messages from more than one. A combination like /conversations/other,inbox still appears to give results, but I do not have enough data available to verify whether it's correct or not right now.