How to send notifications to the device when the backend is connected to wordpress?

admin

Administrator
Staff member
I have a flutter app for both android & IOS , which connects to a wordpress site to pull the posts through wordpress api. I want to add a listener on the wordpress site, such that when a new post is published I would like to send push notifications to the flutter app.

any idea how can i achieve this?

my Approach:

step 1: trigger a function when post is published (<a href="https://www.wphub.com/blog/posts/run-a-function-when-post-published/" rel="nofollow noreferrer">https://www.wphub.com/blog/posts/run-a-function-when-post-published/</a>)
this function will submit a post to my firebase database

step 2: firebase realtime event listener will send notifications to mobile

However I am sure there must be better approach to do this?