So I tried to create a small automation where I get WordPress post comments directly in my WhatsApp messages whenever anyone comments on any of my WordPress blog posts.

I used a Webhook and an HTTP Request node. As I understood it, the Webhook is a listener/receiver that receives data. When a comment is made on my WordPress site, the comment is sent to the Webhook using this code:
add_action('wp_insert_comment', function($comment_id, $comment) { $data = [ 'author' => $comment->comment_author, 'email' => $comment->comment_author_email, 'content' => $comment->comment_content, 'post' => get_the_title($comment->comment_post_ID), 'date' => $comment->comment_date ]; wp_remote_post('https://n8n.example.com/webhook/wp-comment', [ 'method' => 'POST', 'body' => json_encode($data), 'headers' => [ 'Content-Type' => 'application/json' ], ]);}, 10, 2);
The Webhook receives it in JSON format like this:
Continue reading “Receive WordPress post comments to whatsapp:n8n automation”




