phaxio-promise
Send faxes with Phaxio. It's completely asynchronous and uses Promises.
This was based off of the sweet node-phaxio by Chad Smith. It's got a callback interface and works with node v0.8.x.
Requires
- A Phaxio account
- nodejs >= 4.x
Installation
npm install --save phaxio-promise
Usage overview
All functions are based off of the API verbs and all options are from the field names found in the official api docs.
const Phaxio = ;const phaxio = 'apiKey' 'apiSecret'; phaxio;
Resolved data
id: '111111' num_pages: '0' cost: 0 direction: 'sent' status: 'queued' is_test: 'true' requested_at: 1344829113 recipients: number: '13165555555' status: 'queued'
Constructor
new Phaxio(key, secret);
Returns a phaxio client object.
Methods
send(options)
phaxio; // resolves with "faxId":1234 // Examples phaxio; phaxio;
faxCancel(faxId)
Cancels the fax faxId
phaxio;// resolves with no data
faxStatus(faxId)
Returns the status of faxId
phaxio; // resolves with 'id':123456 'num_pages':1 'cost':7 'direction':'sent' 'status':'success' 'is_test':true 'requested_at':1458419092 'completed_at':1458419095 'recipients': 'number':'+19175551212' 'status':'success' 'bitrate':'14400' 'resolution':'7700' 'completed_at':1458419095
fireBatch(batchId)
Fires the batch batchId
phaxio;
closeBatch(batchId)
Closes the batch batchId
phaxio;
provisionNumber(options);
Provisions a number in area code area_code
phaxio; // resolves to 'number': '8475551234' 'city': 'Northbrook' 'state': 'Illinois' 'cost': 200 'last_billed_at': '2013-11-12 11:39:05' 'provisioned_at': '2013-11-12 11:39:05'
releaseNumber(options)
Releases the number number
phaxio;
numberList(options)
Returns user phone numbers matching optional params area_code
or number
phaxio; phaxio;
accountStatus()
Returns the account status
phaxio; // resolves to 'faxes_sent_this_month':0 'faxes_sent_today':0 'balance':'93'
testReceive(options)
Simulates receiving a fax containing the PhaxCode in filename
with optional params from_number
and to_number
phaxio; phaxio; // Resolves with no data
attachPhaxCodeToPdf(options)
Returns a PDF of filenames
with a PhaxCode at the x
,y
location specified with optional params metadata
and page_number
phaxio; phaxio;
createPhaxCode(options)
Creates a new PhaxCode with optional metadata
param and returns the URL. The redirect
param currently doesn't work, don't use it.
phaxio; phaxio; // resolves to"https://url-of-file/"
getHostedDocument(options)
Returns the hosted document name
with a basic PhaxCode or custom PhaxCode if metadata
is set
phaxio;
faxFile(options)
Returns the thumbnail or PDF of fax requested, optional type
specifies p
for pdf (default), s
for small or l
large thumbnails.
phaxio; phaxio;
See the issue tracker for more.
Authors
Francis Gulotta (roborooter.com)
License
This project is UNLICENSED and not endorsed by or affiliated with Phaxio.