-1

this is my issue; I want to send fax dynamically, the content of the fax is a PDF In order to make this PDF available for Twilio Fax API I have upload the PDF as an asset to Twilio, but I do not see any way to achieve this, I have programmatically created assets, but there is no way (at least I can not see one) to attach a PDF as the 'content' of the asset, maybe I'm wrong and there is other way to make those PDF's available for Twilio Fax API

Any help is appreciated Thanks!

  • I've never used this API, but the first thing that appears in the documentation (https://www.twilio.com/docs/fax/send#sending-faxes-with-twilio) explains how it works: you send the **URL** of the PDF file. Twilio will thus make a request to this URL to get the PDF and send it. – JB Nizet Dec 17 '19 at 19:27
  • that is correct, but the document to be sent has to be present in the portal before sending the Fax (which is obvious) and the only way to upload the file in the portal is manual, but; I want to programatically upload the file to the portal, send it via Twilio Fax API and safely delete it from the portal. – g919v3r Dec 19 '19 at 19:43
  • It doesn’t need to be present in the portal, it just needs to be available to Twilio at a URL, it can be hosted anywhere online. – philnash Dec 19 '19 at 20:11

1 Answers1

1

Twilio developer evangelist here.

The Twilio Functions and Assets API is not the best avenue for just uploading a static file to be used as media in a fax. It's built for the creation of application bundles, which is why it comes with the concepts of builds and environments. To upload the actual file, you also need to create an Asset Version.

You could use the Assets section of the Twilio console to upload your PDF, then use the URL in the request.

Alternatively, if you want to do it programmatically, I'd recommend uploading your PDF to something like AWS S3, and then using the resulting URL as the mediaUrl for the fax API.

Let me know if that helps at all.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • yes... that helps, but it will add another dependency (or point of failure) to the process... and this URL has to be public, I do see several issues in this approach. I think, allowing to uploading the file to be sent can be a good improvement to the Twilio Fax API, but thanks for taking the time to answer – g919v3r Dec 19 '19 at 19:35
  • I agree it’s another dependency, however, using a dedicated static file store service over the Twilio Functions and Assets API is going to be a better way to do it. I agree that having a simple file store like that would be more useful for when you’re building with the Fax API, but we don’t have that available as a service I’m afraid. – philnash Dec 19 '19 at 20:17
  • ok, thank you very much. I think I will use a different tool to send faxes. – g919v3r Dec 23 '19 at 19:05