GDPR Compliance

We use cookies to ensure you get the best experience on our website. By continuing to use our site, you accept our use of cookies, privacy policy and terms of service.

GDPR Compliance

We use cookies to ensure you get the best experience on our website. By continuing to use our site, you accept our use of cookies, privacy policy and terms of service.

Add Smart Notifications to WordPress with MsgGO (No Plugin Required)

Introduction

If you're working with WordPress and ever thought “I wish I could get a quick Slack ping or SMS when something important happens on my site” — you're not alone. Whether it's a new user registration, a failed login attempt, or a WooCommerce order, sometimes email just isn’t fast or flexible enough.

In this post, I’ll show you how to use MsgGO, to send real-time alerts from WordPress using nothing more than a bit of PHP and a simple HTTP request. No extra plugins, no bloat — just native WordPress hooks and a flexible external service.

Let’s explore some real-world examples.

What You’ll Need

  • A MsgGO account (Free plan is enough to start)
  • An API Key
  • A configured Event in MsgGO (e.g. new-post, new-user, etc.)
  • Access to your WordPress theme or functions.php

Examples

Notify When a New Post is Published

Why?

  • Let your marketing team know when content goes live
  • Auto-notify a Slack channel for immediate promotion
  • Keep clients in the loop if you manage their site
add_action('publish_post', 'msggo_notify_new_post');

function msggo_notify_new_post($post_ID) {
    $post = get_post($post_ID);
    $payload = [
        'event_name' => 'new-wordpress-post',
        'title' => $post->post_title,
        'author' => get_the_author_meta('display_name', $post->post_author),
        'url' => get_permalink($post_ID)
    ];

    wp_remote_post('https://msggo.io/inbox', [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-MsgGO-Key' => 'YOUR_MSGGO_API_KEY',
        ],
        'body' => json_encode($payload),
        'method' => 'POST',
        'data_format' => 'body'
    ]);
}

Notify on New User Registration

Why?

  • Get instant alerts when someone registers
  • Great for membership sites, gated content, or online courses
add_action('user_register', 'msggo_notify_new_user');

function msggo_notify_new_user($user_id) {
    $user = get_userdata($user_id);
    $payload = [
        'event_name' => 'new-user-registration',
        'username' => $user->user_login,
        'email' => $user->user_email
    ];

    wp_remote_post('https://msggo.io/inbox', [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-MsgGO-Key' => 'YOUR_MSGGO_API_KEY',
        ],
        'body' => json_encode($payload),
        'method' => 'POST',
        'data_format' => 'body'
    ]);
}

Notify on Multiple Failed Logins from Same IP

Why?

  • Identify possible brute-force attacks or credential stuffing attempts
  • Alert security teams or trigger temporary lockdowns
  • Track repeated login issues from known IPs or bots

This example uses wp_login_failed and a transient to track how many times a login has failed from the same IP in a short window (5 minutes). You can trigger a MsgGO alert when the threshold is exceeded.

add_action('wp_login_failed', 'msggo_track_failed_logins');

function msggo_track_failed_logins($username) {
    $ip = $_SERVER['REMOTE_ADDR'] ?? 'unknown';
    $key = 'msggo_failed_' . md5($ip);
    $fail_count = get_transient($key);
    $fail_count = $fail_count ? $fail_count + 1 : 1;
    set_transient($key, $fail_count, 5 * MINUTE_IN_SECONDS);

    if ($fail_count >= 5) {
        $payload = [
            'event_name' => 'security-alert-multiple-failed-logins',
            'ip' => $ip,
            'attempts' => $fail_count,
            'last_username' => $username
        ];

        wp_remote_post('https://msggo.io/inbox', [
            'headers' => [
	              'Content-Type' => 'application/json',
				        'X-MsgGO-Key' => 'YOUR_MSGGO_API_KEY',
            ],
            'body' => json_encode($payload),
            'method' => 'POST',
            'data_format' => 'body'
        ]);

        // Reset after alert
        delete_transient($key);
    }
}

Notify on New Comment

Why?

  • Alert post authors or moderators about new comments
  • Stay engaged with your readers
add_action('comment_post', 'msggo_notify_new_comment');

function msggo_notify_new_comment($comment_ID) {
    $comment = get_comment($comment_ID);
    $payload = [
        'event_name' => 'new-comment',
        'author' => $comment->comment_author,
        'content' => $comment->comment_content,
        'post_url' => get_permalink($comment->comment_post_ID)
    ];

    wp_remote_post('https://msggo.io/inbox', [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-MsgGO-Key' => 'YOUR_MSGGO_API_KEY',
        ],
        'body' => json_encode($payload),
        'method' => 'POST',
        'data_format' => 'body'
    ]);
}

Notify on Contact Form Submission (Contact Form 7)

Why?

  • Deliver messages instantly to Slack, email, or SMS
  • Avoid missing inquiries by checking one place
add_action('wpcf7_mail_sent', 'msggo_notify_cf7_submission');

function msggo_notify_cf7_submission($contact_form) {
    $submission = WPCF7_Submission::get_instance();
    if (!$submission) return;

    $data = $submission->get_posted_data();
    $payload = [
        'event_name' => 'contact-form-submission',
        'name' => $data['your-name'] ?? 'N/A',
        'email' => $data['your-email'] ?? 'N/A',
        'message' => $data['your-message'] ?? ''
    ];

    wp_remote_post('https://msggo.io/inbox', [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-MsgGO-Key' => 'YOUR_MSGGO_API_KEY',
        ],
        'body' => json_encode($payload),
        'method' => 'POST',
        'data_format' => 'body'
    ]);
}

Notify on Critical Settings Changes

Why?

  • Track changes to sensitive options like admin_email, siteurl, or plugin settings
  • Detect misconfigurations or unauthorized admin behavior
add_action('update_option', 'msggo_notify_option_change', 10, 3);

function msggo_notify_option_change($option, $old_value, $new_value) {
    $important_options = ['admin_email', 'siteurl', 'home'];
    if (!in_array($option, $important_options)) return;

    $payload = [
        'event_name' => 'option-changed',
        'option' => $option,
        'old' => $old_value,
        'new' => $new_value
    ];

    wp_remote_post('https://msggo.io/inbox', [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-MsgGO-Key' => 'YOUR_MSGGO_API_KEY',
        ],
        'body' => json_encode($payload),
        'method' => 'POST',
        'data_format' => 'body'
    ]);
}

Notify on WooCommerce Order Status Change

Why?

  • Instantly alert your team of new orders or refunds
  • Notify customers via preferred channels
add_action('woocommerce_order_status_changed', 'msggo_notify_order_status', 10, 4);

function msggo_notify_order_status($order_id, $from_status, $to_status, $order) {
    $payload = [
        'event_name' => 'order-status-update',
        'order_id' => $order_id,
        'status_from' => $from_status,
        'status_to' => $to_status,
        'total' => $order->get_total()
    ];

    wp_remote_post('https://msggo.io/inbox', [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-MsgGO-Key' => 'YOUR_MSGGO_API_KEY',
        ],
        'body' => json_encode($payload),
        'method' => 'POST',
        'data_format' => 'body'
    ]);
}

Why Use MsgGO for WordPress?

  • ❌ No plugin bloat
  • ✉️ Instant multichannel alerts — deliver messages via Slack, Email, SMS, or even URL webhooks, all tailored to the recipient's preferred channel
  • ⚡ Works with any theme or setup
  • 🔒 Secure: API key stays server-side

Try It Now

  1. Sign up at msggo.io
  2. Create events in MsgGO for the hooks you want
  3. Paste the matching code snippets in your theme's functions.php
  4. Trigger an event and watch the notifications flow!

Need help? Check the docs or contact support. Happy coding!