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. Twilio has been used to build SMS and VoIP communication in some of the most amazing products such as Hulu, AirBnB and Sendhub. They're reasonably priced and have an excellent API.
"Twilio powers the future of business communications, enabling phones, VoIP, and messaging to be embedded into web, desktop, and mobile software."
This plugin allows developers to extend the Twilio API into WordPress and build exciting communication based themes and plugins. (Yes it's free to download and GPL).
Currently, the plugin only supports SMS functionality, but the plan is to add VoIP within the upcoming months. The plugin primarily allows a WordPress developer to build on top of Twilio directly within their theme or plugin by providing custom functions, hooks and filters. Here's a list of what the plugin provides out of the box:
- Mobile Phone User Field added to each profile
- Custom function to easily send SMS messages to any number (including international ones)
- Custom filter to modify the response WordPress gives when a user texts your Twilio number
Sends a standard text message from your Twilio Number.
Parameter | Type | Description ------------- | ------------- | ---- $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. $from | string | Twilio Number message is coming from. Must be formatted as country code + 10-digit number. Default value is Twilio Number.Returns an array with response from Twilio's servers
$to = "+13362522164";
$message = "Hello World";
twilio_send_sms( $to, $message );
Parameter | Type | Description |
---|---|---|
$twixml | string | The Twilio XML that will serve as the response |
$sms | array | The current SMS that has been sent to WordPress. Standard parameters are "To","Body","From". More parameters can be found in the Twilio Request Documentation. |
// Case-insensitive check to see if the SMS only had the word hello in it if ( strcasecmp( $sms['Body'], 'hello' ) == 0 ) {
$twixml .= "<Message>Hey how are you?!</Message>";
}
return $twixml;
}
add_filter( 'twilio_sms_callback', 'my_twilio_sms_callback' , 10, 2 );
<h5>Copyright</h5>
Plugin created by <a href="http://marcusbattle.com/plugins/twilio-for-wordpress">Marcus Battle</a>.
Disclaimer: This plugin is not directly supported by Twilio,Inc. Please do not contact them for support as they will not be able to help you with it. All logos and trademarks are the property of their respective owners.