Voice Blogging with Twilio & WordPress

November 13, 2009
Written by
Danielle Morrill
Contributor
Opinions expressed by Twilio contributors are their own

Twilio Bug Logo

Jeff came across this blog post, talking about using Twilio to build a voice blogging system that integrates with WordPress, and as a WordPress fanatic (yes, I know we use Typepad here) I was excited to give it a try and find out exactly how it works.

The source code is open sourced, so you can download it or visit the github repository.  All you’ll need to run it is a server with php, and a free Twilio account to use our Programmable Voice API.

As the author of “Blogs Are Wrong” says:

I thought it would be cool to make a system that lets me blog from my
cell phone.  And so I started stitching it together.  Seven hours
later, the sun was up, and I had worked out a system where I call a
special phone number and I get a prompt.  I speak into the phone, just
like I’m leaving a message, and the system records my speech as a sound
file and then processes it to turn the speech into text.  It then puts
together a post to my blog with a link to the sound file and the
transcription below.  It’s not a substitute for carefully written
essays, but if you want to record and share a quick (I limit it to 2
1/2 minutes) thought with the world, it’s a pretty easy way to go about
it.

Wp-voice-blog-post


Getting Started with Twilio for WordPress

Not into scouring README files to understand what it will take to get code up and running?  That’s okay.  Here’s a rundown of how to get started:

  • * make sure you have a server that runs PHP
  • * create a Twilio account – the free trial gives you a $30 credit
  • * upload the code to your server, and put it in a directory that’s accessible online (so Twilio can reach it)
  • * edit remotePost.class.php – Change the $wpURL variable to the URL of your wordpress blog, but keep the ‘xmlrpc.php’ ending.
  • * edit remotePost.class.php – Change the $uname variable to the name of a user for your  blog, and the $pass variable to that user’s password.
  • * this is optional, but you can change the the image displayed on your blog for voice posts by opening up voicepost.php and replacing the image URL in the following line

 

$body .= “”>

”;

Configuring Your Twilio Account

That’s it! There’s just one last thing you need to do:
Log in to twilio.com and, on the account dashboard page, scroll about
halfway down. There’s a box labeled ‘Your Trial Sandbox,’ and in that
box, there’s a phone number, a PIN, and a field labeled ‘USES URL’
In that field, put the web address of the directory you placed these
files in, with ‘makerecording.php’ tacked on to the end (i.e.
http://www.myserver.com/mydirectory/makerecording.php)
sweet! Now just call the phone numbe on your account page (it’s
probably 866.853.6913) and enter the PIN code from your account page.
The software will prompt you to talk. Hang up whenever you’re done,
and the blog post will appear in a minute or two on your site.
Hooray!

Get Your App on the Twilio Blog

Building something with Twilio that you’d like us to share with the world?  Drop us a line at help@twilio.com so we can get your creation on our blog. 

Photo credit: