Phaxio integration using HttpClient & ASP.NET MVC
I have a need for fax (yes, fax!) in an application I’m working on and ran across a cool little startup called Phaxio. Phaxio takes a different approach to fax than most of the
dinosaurs competitors in the field.
The fax API for devs. We make faxing as simple as an HTTP POST and have innovative features that help your HA webapp use fax in new and exciting ways!
Overall the product is great, nice api, good tooling, easy to integrate and straight forward pricing.
Integrating w/ Phaxio was the perfect opportunity to try out the new HttpClient in .Net. Given both of them are pretty new there are not many code samples available, so I thought I would share mine.
Sending a fax in Phaxio is as simple as making a POST request. The API currently takes POST’s via application/x-www-url-form-encoded, but the team seems pretty receptive to feedback about also taking a JSON payload. Either way, It really couldn’t be easier with HttpClient.
When Phaxio receives the request, the fax is queued for sending. Once the fax is delivered your application callback gets a copy of the details (Phaxio handles all the hard stuff). I am using ASP.NET MVC, so receiving a x-www-url-form-encoded POST is pretty trivial.
… and that’s it. Admittedly not terribly exciting but really fun to work on nonetheless (I enjoy integration, and integration with startups… oh hell ya). Tonight: Twilio!