We have made the difficult decision to disable Programmable Fax for all accounts on December 17, 2021. For new and inactive accounts, access to Programmable Fax is disabled effective immediately. We recognize the challenges this decision might cause and have provided detailed migration plans to prevent disruptions.
This guide walks through receiving a fax with Twilio Programmable Fax. We include sample code for many web languages and frameworks. For other frameworks (or languages) you can choose to use a helper library or directly respond with TwiML to receive a fax.
To receive a fax, you will require:
- An Incoming Phone Number configured as a fax number.
- Note: this will cause the number to be unavailable to receive calls using Programmable Voice
FaxUrlwhich Twilio will query when a fax is received.
First, ensure that you have an Incoming Phone Number on your account that supports receiving faxes. The number you select should have
true for the
fax item in the
capabilities object. Alternatively, you can check using the console:
If you don't have a fax-capable number, you'll need to first purchase one. You can either use the Available Phone Numbers REST API resource (query with
FaxEnabled=true), or Console Phone Numbers Search (/console/phone-numbers/search) (check the box to search for numbers with the Fax capability) to do so.
Next, you need to configure the number's Voice Receive Mode so that the number receives faxes rather than voice calls. Again, you can use the API's Incoming Phone Numbers resource (
POST to the instance resource with
VoiceReceiveMode=fax) or the Console. If using the Console, select the phone number you want to use from the list, and change the value of the "Accepts" dropdown box to "Faxes":
At this point, the number's
VoiceUrl will now behave as its
FaxUrl. Again, note that the number will now be unable to receive regular voice calls.
You may also choose to configure an incoming status callback URL in the Fax Status Changes field, to be notified if the transmission was "Received' or had 'Failed'.
Please note, this URL will only be hit if the <Receive> action URL is omitted.
The following examples show how to receive a fax with common web languages and frameworks and are ready for you to incorporate the code in your application.
If you are not using one of these languages and frameworks:
- If you are using one of these languages with a different framework, you can use the Twilio helper library in a similar way to receive faxes.
- If you are using a different language, you can respond to Twilio's request with TwiML to receive the fax. Read beyond the sample code for more details.
If requesting a fax media file from a web application, you must specify a User-Agent header in your request to Twilio.
When Twilio receives a call to an incoming phone number that has been configured as a Fax number, we will make an HTTP request to the
FaxUrl configured for that number. Your server should respond with TwiML that instructs Twilio how to proceed.
Log data for each fax will be available via the REST API for 180 days after creation. When old fax records are pruned, Twilio will also delete the media associated with the pruned records. If you wish to delete data before that, you can delete just the media, or the entire resource, including the media.
Now you've seen how to receive faxes with common web languages and frameworks, as well as pointers if you are using a different framework or language.
Want to see more advanced features? Next, see the Fax REST API documentation.
Update on Fax Beta
We have received feedback from our customers about inconsistent performance when receiving Faxes on Twilio numbers. We have taken this feedback seriously and are actively working to improve the Fax product. We want to make sure that the product we release meets the quality and standards that our customers expect from us.
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。