My company has an app and I have tasked with alerting a chat room in the app when a custom post type is published. I downloaded the WP REST API plugin and activated it on a test install. I have everything configured from the app side. But I have no idea what the next steps are from the WP end. Can someone point me to an example?
This has nothing to do with WP REST API. WP REST API works by requesting something from WordPress and then delivering that data, both in JSON.
What you look for are webhooks, you need to create webhook when something happens in WordPress (new post published) that pings your URL. Another way is that your app directly communicates with WordPress. This all depends how your app works.
I was searching in google and found this maybe can help you
Luis Abarca answers:
You only need to use [[LINK href="https://codex.wordpress.org/Function_Reference/wp_remote_post"]]wp_remote_post[[/LINK]] and send the data to your server.
add_action('save_post_youposttype', 'send_post_data', 10, 2);
function send_post_data($post_id, $post)
$args = array(
'post_id' => $post_id,
'post_title' => get_post_field($post_id, 'post_title')