Unable to create custom API in forum to get count of unread messages
I am working on a Laravel project. I have set up the vanilla forums.
I am trying to get the counts of unread messages because I want to display it on my website page' notification. I mean when a user logs in to my website, I want to display the count of the unread messages(notifications) in the header.
I know vanilla forum already displays the count of unread messages on their page but I want that count to display on my website page. Otherwise, the users will have to go to the forum page again and again just to see if any message has arrived.
I have been trying to make a custom API in forum for this. So that I can call the forum methods in my custom API and send back the response to my controller. But the Vanilla Forum Developer Doc's "Writing APIs" section is not that much technically detailed. It didn't help me. I am unable to understand how these APIs are working, and how to create a custom one.
I must send the count of unread messages to my website. Please give any solution.
If the user is already logged in into the forum, it is as easy as that: