WP Manifestindependent plugin directory
manifest / integrations / random-slack-messages

Best Practices Reminder

WP plugin for sending periodic messages to Slack

by Milos Milosevic · github.com/mmilosevic87/random-slack-messages · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/mmilosevic87/random-slack-messages/archive/refs/heads/master.zip

A WordPress plugin that sends a daily best-practice reminder to a Slack channel, cycling through posts in a round-robin queue.


What It Does

This plugin provides a simple system for delivering recurring tips, reminders, or best practices to your team via Slack:

  1. Custom Post Type — Registers a "Best Practices" post type in the WordPress admin where you create and manage your reminder messages
  2. Daily Cron Job — Every day, the plugin picks the post that was shown longest ago (round-robin rotation)
  3. Slack Delivery — Sends the selected post's content to a configured Slack webhook
  4. Queue Rotation — After a successful delivery, the post's timestamp is updated so it moves to the back of the queue

This means if you have 10 best-practice posts, each one will be sent roughly once every 10 days, cycling through all of them continuously.


How It Works

WP-Cron (daily)
    │
    ▼
Pick oldest post ──► No posts? → Exit
    │
    ▼
Send to Slack ──► Failed? → Exit (retry next run)
    │
    ▼
Update timestamp (post moves to back of queue)

Each "Best Practices" post has a bpr_time meta field that records when it was last sent. The plugin queries for the post with the oldest bpr_time value, sends its content to Slack, and then updates the timestamp to now. Posts that fail to send are not rotated — they stay at the front of the queue and will be retried on the next cron run.


Benefits

  • Automated team reminders — No manual effort after initial setup. Your team gets a daily best-practice tip in Slack.
  • Round-robin delivery — Every post gets equal airtime. No duplicates until the full cycle completes.
  • Failure-safe rotation — Posts only rotate after successful delivery, so nothing gets skipped silently.
  • Easy content management — Add, edit, or delete reminders through the familiar WordPress post editor.
  • Zero configuration UI — The only setup is adding the Slack webhook URL to wp-config.php.

Requirements


Installation

  1. Download or clone this repository into wp-content/plugins/:

    cd wp-content/plugins
    git clone https://github.com/MMilosevic87/random-slack-messages.git
  2. Add your Slack webhook URL to wp-config.php:

    define( 'SLACK_WEBHOOK', 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL' );
  3. Activate the plugin in Plugins > Installed Plugins

  4. Go to Best Practices in the admin sidebar and create your reminder posts


Usage

Adding Reminders

  1. Navigate to Best Practices > Add New in the WordPress admin
  2. Enter a title (for your reference — not sent to Slack)
  3. Enter the reminder text in the editor (this is what gets sent to Slack)
  4. Publish the post

How Rotation Works

  • New posts automatically get a default timestamp that places them at the front of the queue
  • The "BPR Time" metabox on each post shows when it was last sent
  • The post with the oldest timestamp is always picked next
  • After successful delivery, the timestamp updates to the current time

Monitoring

  • Check the "BPR Time" metabox on any post to see when it was last sent
  • Failed deliveries are logged to the WordPress error log (wp-content/debug.log when WP_DEBUG_LOG is enabled)

File Structure

random-slack-messages/
└── rsm.php          # Complete plugin — CPT, cron, Slack delivery, metabox

Configuration

The only required configuration is the SLACK_WEBHOOK constant in wp-config.php.

Constant Where Description
SLACK_WEBHOOK wp-config.php Your Slack Incoming Webhook URL

Creating a Slack Webhook

  1. Go to api.slack.com/apps
  2. Create a new app (or select an existing one)
  3. Enable Incoming Webhooks
  4. Add a new webhook to a channel
  5. Copy the webhook URL and add it to wp-config.php

Technical Details

  • Cron schedule: Registered on plugin activation, cleared on deactivation
  • Post selection: WP_Query ordered by bpr_time meta value (ascending), limited to 1 published post
  • Slack delivery: Uses wp_remote_post() (WordPress HTTP API) with proper SSL verification
  • Error handling: Logs failures to error_log(), does not rotate failed posts

License

GPL-3.0