Administrators of a multi user WordPress website do not need to know about every change their users make on the website. Keeping a record of all changes in an activity log (activity log or activity log) which you can refer to in case there is a problem is good enough.
However, you have to be instantly alerted of critical changes and user actions. Changes that can impact the security or operations of your website and business. For example, when an administrator logs in to your WordPress website outside office hours you want to receive a SMS alert.
In this post we will explain why SMS messages are better than emails for WordPress notifications, and how to configure SMS notifications on your WordPress sites with the WP Activity Log plugin.
Instant WordPress alerts & notifications – why SMS messages are a better fit than emails
Emails were not designed for instant messaging or as alerts. They are not as reliable as SMS messages and they can get blocked by antispam and other filters. And if not, there is no guarantee that the recipient reads an as soon as it is delivered, especially if they receive hundreds of emails every day.
On the other hand, SMS messages are instant and in most cases recipients read them within a short span of time. Users give priority to SMS messages over emails because mobile numbers are private, unlike email addresses. So when a recipient receives an SMS message, most probably it is from someone who they know.
How to configure SMS notifications in WordPress
This step by step guide explains how you can configure instant SMS alerts for when there are critical user actions on your WordPress website. As an example we will configure the plugin to send an SMS notification when the following happens:
- A WordPress user with administrator logs in to the website
- The time is outside office hours
- The IP address is not the office one.
The concept of how SMS notifications work is very simple; configure a criteria and once the data in the activity logs matches the criteria an SMS messages is sent. Therefore you can easily configure instant SMS notifications for any type of user activity.
Step 1: Install the WP Activity Log plugin
The first step is to keep a record of user actions in the activity log. You have to do this with the WP Activity Log plugin. The plugin is very easy to use; once it is installed it will automatically keep a log of user changes. Refer to the activity log plugin getting started guide to learn more about fine tuning the plugin.
Note: SMS notifications are available in the premium edition of the plugin. Get a free 14-day trial of the WP Activity Log premium.
Step 2: Create and configure the Twilio account
The WP Activity Log plugin uses Twilio to send SMS notifications. Twilio is one of the most popular cloud based communications services. You can try Twilio for free. In the free account you will get $15 credit, so you can run some tests.
During the registration process you have to verify your email and mobile phone number. Note: When using the free account you can only send SMS messages to verified number. Hence why it is important to verify your mobile number.
Step 3: Configure Twilio integration in the WP Activity Log plugin
In this step you will integrate the Twilio account integrate with the plugin. To do so, navigate to the SMS Provider tab in the plugin’s settings and copy over the Account SID, Auth Token and the Twilio Number or the Alphanumeric ID.
Note: when you register for a Twilio account you will get a trial number. This is the Twilio number. When using a premium account you can change it or even use an Alphanumeric ID.
Test the Twilio integration and SMS messages delivery
Click the Test link to test the integration. To run the test specify the recipient number, the test message and click the Send Message button.
Step 4: Configure the SMS notification criteria
The notification criteria
Now that the integration is ready configure the SMS notification criteria. To recap, in this example we want to receive an SMS alert when an administrator logs in to the WordPress website outside office ours, and the IP address is not the office one. Considering the office hours are from 9:00AM until 5:30PM, and the office IP address is 126.96.36.199, then the criteria should be:
- Event ID is 1000 (event ID 1000 means a user logged in. Refer to the complete list of activity log event IDs to learn which IDs are associated with which user actions).
- User role is administrator.
- Time is outside office hours. So it should be either before 9:00AM or after 5:30PM.
- IP address is not 188.8.131.52.
Configuring the notification criteria in the plugin
Follow the below procedure to configure the above notification criteria in the WP Activity Log plugin:
- Click Notifications in the plugin’s menu and the Custom Notifications tab.
- Click Add New and specify a title for the notification. In our case we used Admin login – outside office hours – not office IP.
- Click Add Trigger and add the following triggers individually:
- Event ID IS EQUAL 1000
- USER ROLE IS EQUAL ADMINISTRATOR
- SOURCE IP IS NOT 184.108.40.206
- TIME IS BEFORE 09:00AM
- TIME IS AFTER 05:30PM
- Click the Grouping drop down menu next to the Time is before 9:00AM criteria and select Group with the below trigger.
- Set the operand between the last two time criteria to OR as per the screenshot above.
- Specify the mobile number and email address (optional) of the recipient that should be notified. If you are using a Free Twilio account use a verified number.
- Click Add Notification to save the notification.
This is how the above notification criteria looks like:
(EVENT ID IS EQUAL 1000 AND USER ROLE IS EQUAL ADMINISTRATOR AND IP ADDRESS IS NOT 220.127.116.11) AND (TIME IS BEFORE 9:00AM OR TIME IS AFTER 5:30PM)
Instant SMS alerts for critical user actions on your WordPress site
That is it! The next time a user with administrator role logs in to your WordPress website outside office hours, and the IP address is no the office one, you will receive an SMS notification.
You can also configure the SMS message template. Do so if you want to add more details in the notification, such as the event severity.
Get instant SMS alerts of other critical WordPress site changes
The WP Activity Log plugin uses a unique activity log event ID for every type of user and site change. So it is really easy to configure instant SMS notifications for when there are critical changes on your WordPress website. Below are some examples of the notifications you can configure:
- The content of the home page has changed (use event ID 2065 and the page’s ID)
- A file on your WordPress website was modified (use event ID 6028)
- Someone installed or activated on your WordPress website (use event ID 5000 or event ID 5001)
The list of possible notifications is endless. Find out which event ID to use from the complete list of event IDs in the WordPress activity log. We also recommend the getting started guide to emails and SMS notifications for WordPress for more detailed information of how to build notification criteria and more!