Skip to content

cparate43/wp-twilio-core

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP Twilio Core

WP Twilio core is a simple plugin to add SMS capability to your website using the Twilio API.

If you've ever wanted to add text messaging functionality to your website or app, Twilio is one of the best solutions on the market. They're reasonably priced and have an excellent API.

How does it work?

The plugin primarily allows a WordPress developer to extend its settings and functionality and integrate it into any type of site. For example, it can easily be extended to send a text message on virtually any WordPress action.

The plugin also includes functionality to directly send a text message to any permissible number from the plugin settings page. You can use it to SMS any of your users or just for testing purposes

Here's a list of what the plugin provides out of the box:

  • Custom function to easily send SMS messages to any number (including international ones)
  • Functionality to directly send a text message to any permissible number from the plugin settings page
  • Hooks to add additional tabs on the plugin settings page to allow managing all SMS related settings from the same page
  • Basic logging capability to keep track of up to 100 entries
  • Mobile Phone User Field added to each profile (optional)
  • Shorten URLs using Google URL Shortener API (optional)

twl_send_sms( $args )

Sends a standard text message from your Twilio Number when arguments are passed in an array format. Description of each array key is given below.

Array Key | Type | Description ------------- | ------------- | ---- number_to | string | The mobile number that will be texted. Must be formatted as country code + 10-digit number (i.e. +13362522164). message | string | The message that will be sent to the recipient. number_from *(optional)* | string | Override the Twilio Number from settings. Must be associated with Account SID and Auth Token account_sid *(optional)* | string | Override the Twilio Account SID from settings. Must be associated with Twilio number and Auth Token. auth_token *(optional)* | string | Override the Auth Token from settings. Must be associated with Twilio number and Account SID. logging *(optional)* | integer (1 or 0) | Override the logging option set from the settings page. Requires the digit '1' to enable. url_shorten *(optional)* | integer (1 or 0) | Override the URL shortening option set from the settings page. Requires the digit '1' to enable.

Returns an array with response from Twilio's servers on success of a WP_Error object on failure.

Example
$args = array( 
	'number_to' => '+13362522164',
	'message' => 'Hello Programmer!',
); 
twl_send_sms( $args );	

Extending the Settings page

It is very easy to add your own tab to the plugin settings page. Please see the example below:

// Registering a new tab name
function add_new_settings_tab( $tabs ) {
	$tabs['my_shop'] = 'My Shop';
	return $tabs;
}
add_filter( 'twl_settings_tabs', 'add_new_settings_tab' );

// Adding form to that new tab
function add_my_shop_tab_content( $tab, $page_url ) {
	if( $tab != 'my_shop' ) {
		return;
	} 
	// Add my settings form here!
}
add_action( 'twl_display_tab', 'add_my_shop_tab_content', 10, 2 );
Contributors
Feel free to send pull requests. They are always welcome!
Copyright
[WP Twilio Core](https://themebound.com/shop/wp-twilio-core/) plugin created by [Themebound](https://themebound.com/). It is also available at the [WordPress Plugins repository](https://wordpress.org/plugins/wp-twilio-core/). For custom integration with your WordPress website, please [contact us here](https://themebound.com/contact-us/).

Disclaimer: This plugin is not affiliated with or supported by Twilio, Inc. All logos and trademarks are the property of their respective owners.

About

A simple plugin to add SMS capability to your website using the Twilio API. Allows developers to easily extend the settings page and built in functionality.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 95.5%
  • Python 2.4%
  • Makefile 2.1%