Skip to content

wp-sms/wp-sms

Repository files navigation

Average time to resolve an issue Percentage of issues still open WP compatibility PHP compatibility

WP SMS Plugin

The Best WordPress SMS Messaging and Notification Plugin for WordPress!

This plugin adds the ability to send SMS to your WordPress through more than 200 SMS gateways, such as Twilio, Plivo, Clickatell, BulkSMS, Infobip, Vonage (Nexmo), Clockworksms, Messagebird, Click send and much more! See All SMS Gateways

Additionally, you can send SMS/MMS message notifications to your subscribers, users, and WooCommerce customers about their orders, new posts, products, and more.

Watch the video to learn more about the WordPress SMS Plugin!

Introducing WordPress SMS Plugin

Send SMS by PHP:

$to[] = '01000000000';
$msg = "Hello World!";

wp_sms_send( $to, $msg );

Send MMS:

$mediaUrls[] = 'https://yoursite.com/image.png';

wp_sms_send( $to, $msg, false, false, $mediaUrls );

Features

  • Supported +180 sms gateways. (List all gateways)
  • Send SMS/MMS to number(s), subscribers and WordPress users.
  • Subscribe newsletter SMS.
  • Send activation code to subscribe for complete subscription.
  • Notification SMS when published new post to subscribers.
  • Notification SMS when the new release of WordPress.
  • Notification SMS when registering a new User.
  • Notification SMS when get new comment.
  • Notification SMS when user logged into WordPress.
  • Notification SMS when user registered to subscription form.
  • Integrate with (Contact form 7, WooCommerce, Easy Digital Downloads)
  • Supported WP Widget for newsletter subscribers.
  • Support WordPress Hooks.
  • Support WP-REST API
  • Import/Export Subscribers.

Internationalization

WP SMS has been translated in to many languages, for the current list and contributors, please visit the translate page.

Translations are done by people just like you, help make WP SMS available to more people around the world and do a translation today!

Installation

This is a development (pre-build) version which mean the assets are not built, and you need to build them yourself. for downloading the latest stable version, please visit the WordPress Plugin Directory.

Clone the GitHub repository

Clone the repository into your plugins directory and activate the plugin.

[email protected]:veronalabs/wp-sms.git

Install dependencies

composer install

Build Assets

Requirement: Before any build it`s necessary to fix these below versions then use npm

  • npm v6.*
  • node v14.*

Install dependencies

npm install

Build the blocks

npm run build

Build the assets

npm run sass-compile
npm run js-compile

Unit Tests

The plugin has a suite of unit tests that can be run with PHPUnit. To run the tests, you'll need to install the development dependencies with Composer, then run the tests with Codeception

composer install

For starting you need to create a database for testing, then copy the .env.testing.example file to .env.testing and update the database credentials.

Import the database from tests/_data/dump.sql in your test database.

wp db import tests/_data/dump.sql

Run the tests

php vendor/bin/codecept run wpunit

Generate new unit test

php vendor/bin/codecept generate:wpunit unit YourTestName

Actions

Run the following action when sending SMS with this plugin.

wp_sms_send

Example: Send mail when send sms.

function send_mail_when_send_sms($message_info) {
	wp_mail('[email protected]', 'Send SMS', $message_info);
}
add_action('wp_sms_send', 'send_mail_when_send_sms');

Run the following action when subscribing a new user.

wp_sms_add_subscriber

Example: Send sms to user when register a new subscriber.

function send_sms_when_subscribe_new_user($name, $mobile) {
    $to = array($mobile);
    $msg = "Hi {$name}, Thanks for subscribe.";
    wp_sms_send( $to, $msg )
}
add_action('wp_sms_add_subscriber', 'send_sms_when_subscribe_new_user', 10, 2);

Filters

You can use the following filter for modifying from the number.

wp_sms_from

Example: Add 0 to the end sender number.

function wp_sms_modify_from($from) {
	$from = $from . ' 0';
	
	return $val;
}
add_filter('wp_sms_from', 'wp_sms_modify_from');

You can use the following filter for modifying receivers number.

wp_sms_to

Example: Add new number to get message.

function wp_sms_modify_receiver($numbers) {
	$numbers[] = '09xxxxxxxx';
	
	return $numbers;
}
add_filter('wp_sms_to', 'wp_sms_modify_receiver');

You can use the following filter for modifying text message.

wp_sms_msg

Example: Add signature to messages that are sent.

function wp_sms_modify_message($message) {
	$message = $message . ' /n Powerby: WP SMS';
	
	return $message;
}
add_filter('wp_sms_msg', 'wp_sms_modify_message');

Resources