Allow Fax To Reintroduce Itself: Meet Twilio Programmable Fax - Twilio
Power modern communications. Build the next generation of voice and SMS applications.
Start building for free

Allow Fax To Reintroduce Itself: Meet Twilio Programmable Fax

TwilioFaxFeatured

The technology that brings you on-demand food in 5 minutes is new. The fax machine that printed out your order at the restaurant is not.

Fax is still an essential tool for a variety of organizations – from hospitals to law offices, from pizza shops to the offices of the Federal Investigation Bureau. But, fax was offline and brittle. Today, it’s online and ready to work.

We’re happy to announce we’ve launched Programmable Fax in Beta. You can now programmatically send and receive faxes using Twilio between any software application and a traditional fax machine.

Making Fax Flexible

Software is flexible. We’ve grown accustomed to bending it in and around obstacles to solve problems. Fax, like most legacy hardware, couldn’t bend the same way as software. With this release, fax becomes a great deal more flexible.

Fax was once relegated to fax machines. Phone calls were once relegated to phones, too. Now, sending fax with Twilio is as easy as making a phone call with Twilio. This saves businesses from the cost of a rip and replace operation, while giving them all the benefit of a newly minted software solution.

A great deal of businesses use both software and legacy hardware, like fax, to solve problems. Unfortunately, switchover costs and logistical constraints tend to keep those tedious, outdated legacy systems in place. This release gives those organization more dexterity when it comes to fax.

Take Slice for example. Slice lets you order pizza from a network of restaurants across the U.S. online or through their app, 24/7.  A majority of the restaurants Slice works with use fax to take inbound orders.

Pizza via Fax

Slice takes their users’ orders made on a software platform, like their website or app, and carries the order into the domain of hardware in the form of a fax to a restaurant. Using Twilio Programmable Fax, Slice can confidently send thousands of orders via fax, daily.

“Fax has always been part of our stack, going back 7 years. We just have to use it,” says Sam Kennedy, VP of Engineering at Slice. “The longer it takes to send a fax, the longer hungry customers have to wait for their pizza. The more faxes we can send, the more users we can serve. With Twilio Programmable Fax, we can send thousands of orders immediately, scale to our users’ demand, and do so confidently.”

You’re only a few clicks away from sending fax like Slice. Here’s how you use Twilio Programmable Fax.
 

How To Send A Fax

Check out all the docs on Twilio Fax here

You can now send a fax via POST request to Twilio. Include the fax-enabled Twilio number you’re sending the fax from, the recipient’s number, and the media URL of the fax. We currently only support media files in PDF format. Fire off the POST request and you’ve just sent a fax programmatically.

curl 'https://fax.twilio.com/v1/Faxes' \
    -X POST \
    -d 'To=%2B15558675309'  \
    -d 'From=%2B15017250604'  \
    -d 'MediaUrl=https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf' \
    -u AC93c019bcdXXXXXXXXXXXXXXXXX:your_auth_token

How To Receive A Fax

To receive a fax, configure your Twilio number as a fax number. This takes all of two seconds and a click from a dropdown menu. When someone sends a fax to your Twilio number, Twilio hits the URL you specified in the “When A Fax Comes In” field. You can easily configure this field with TwiML to accept or reject a fax. Once Twilio receives the fax, it will be converted to a PDF and stored.

const http = require('http');
const express = require('express');
const bodyParser = require('body-parser');

const app = express();

// Parse any incoming POST parameters
app.use(bodyParser({ extended: false }));

// Define a handler for when the fax is initially sent
app.post('/fax/sent', (req, res) => {
  // Let's manually build some TwiML. We can choose to receive the
  // fax with <Receive>, or reject with <Reject>.
  const twiml = `
  <Response>
    <Receive action="/fax/received"/>
  </Response>
  `;

  // Send Fax twiml response
  res.type('text/xml');
  res.send(twiml);
});

// Define a handler for when the fax is finished sending to us - if successful,
// We will have a URL to the contents of the fax at this point
app.post('/fax/received', (req, res) => {
  // log the URL of the PDF received in the fax
  console.log(res.body.MediaUrl);

  // Respond with empty 200/OK to Twilio
  res.status(200);
  res.send();
});

// Start the web server
http.createServer(app).listen(3000, () => {
  console.log('Express server listening on port 3000');
});

Twilio Programmable Fax is supported globally for outbound faxes. We are rolling out support for inbound phone numbers for all of Twilio’s voice enabled inventory. The first batch of numbers to be enabled are in the US & Canada with the rest of the inventory coming online over the next month.

We can’t wait to see what you build with new, flexible Twilio Programmable Fax.

Sign up and start building
Not ready yet? Talk to an expert.