Tag: Twilio

Anonymous Code of Conduct Reporting With Twilio

August 29, 2016 » Geek

I’m lucky to be one of the organizers of NEJS Conf, a great little JavaScript & frontend conference here in Omaha, NE.

One of the core values we’ve held since the beginning of our conference was for it to be diverse, respectful and safe. To that end we adopted a Code of Conduct from the very beginning, based on the excellent JSConf example.

Our first year, we identified specific volunteers as our CoC points of contact. It seemed like a good plan, but our only report that year came via a circuitous route, which may have been a result of the face-to-face reporting we had defaulted to.

This spring I got to attend Twilio’s SIGNAL conference, and one neat thing they had in their Code of Conduct was an anonymous reporting phone line. Sounds like a good idea, and something fun to build!

The plan is simple: add a Twilio backed phone number which anonymizes incoming SMS and calls, then forwards them to the code of conduct reporting volunteer. Twilio makes this easy. At it’s core it’s just two TwiML files, one for SMS and one for Voice.

The SMS response contains the original message, a destination number to send it to (i.e. the CoC volunteer), a unique ID per reporter, and a link to the web interface. Behind the scenes we are doing a little but of work to assign the ID, match up numbers to destinations, etc, but not a lot of work total.

<?xml version="1.0" encoding="UTF-8" ?>
  <Message to="{{ destination_number }}">[{{ reporter_id }}] {{ message_body }}

{{ link }}</Message>

Voice is even simpler. Here we just connect the call to the CoC volunteer, and spoof the caller ID with the hotline’s number.

<?xml version="1.0" encoding="UTF-8"?>
  <Say>Connecting, one moment.</Say>
  <Dial record="true" callerId="{{ caller_id }}">{{ number.destination }}</Dial>

That’s the core of it, only took an evening to get things running. As I hinted above, I added a web interface for replying to reporters, as well as seeing the entire interaction in one place.

SMS Reporting Web Interface Voice Reporting

If you’d like to run this for your event, the source is all on github. https://github.com/jmhobbs/simple-coc

Tags: , , ,

Developing For Twilio In PHP – Introducing Twillip

September 16, 2010 » Geek

Last weekend I had the fun opportunity of building my first Twillio app with a group at the Omaha Startup Weekend. We wrote a phone based version of chattroulette called Call Spinner which includes a cool advertising system we hope to expand on.

Developing for Twilio isn’t that hard, it’s mostly just about generating the right XML. We used the PHP library Twilio provides and it’s pretty nice, but debugging off of the Twilio website was a waste of money and not much fun.

So, over the last few days I worked out a nice debugging tool I decided to call Twillip. What it does is conditionally wrap your code and prints it in a clean fashion, with links and variables and other goodies like that.

Super simple to use too! Here, this is a contrived example. Normally you probably want some sort of cool dispatcher (I have one of those if you want it) and to check that requests are signed, etc.


addSay( 'This app uses Twillip for obviously awesome reasons!' );
    $r->addPlay( 'funky-beats.mp3', array( 'loop' => 3 ) );
    $r->addRedirect( '/doesntexist.php' );
  else {
    $r->addSay( 'Oh no! I didn\'t get sent a phone number! Who in blue blazes are you?' );
    $r->addSay( 'This line will generate a PHP warning now: ' . $_REQUEST['Caller'] );

  if( IS_DEV ) { Twillip::End(); }

Sweet, so what does that buy us? Only this awesome interface is all!

Twillip - Oops!

But there is an error! $_REQUEST['Caller'] isn’t set. We can fix that by clicking on the Add New Input and filling it in.

Twillip - New Input Prompt

Twillip - New Input

There it is! Now we can click Reload Page and it will refresh with all of the inputs.

Twillip - No More Errors!

You can’t tell in the image, but the Redirect and Play verbs are both clickable links, and will bring all of the variables in the input section with them.

Seeing is believing, so try it out at http://static.velvetcache.org/pages/2010/09/16/developing-for-twilio-in-php-introducing-twillip/demo/

You can grab the source at http://github.com/jmhobbs/Twillip.