
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A Node.js client library for interacting with the WestFax Secure Cloud Fax API. WestFax is a HIPAA Compliant Secure Cloud Fax company that specializes in high volume, high availability digital cloud fax with a primary focus on Healthcare and medical applications.
npm install westfax
Sign up for a WestFax account to receive your username and password.
Most WestFax API calls require a ProductId. Here's how to get it programmatically:
const WestFax = require('westfax');
// Initialize client with just username and password
const client = new WestFax({
username: 'your_username',
password: 'your_password'
});
// Get product list and find your ProductId
async function getProductId() {
try {
const productList = await client.getF2EProductList();
if (productList.Success && productList.Result.length > 0) {
// The first product ID in the list
const productId = productList.Result[0].Id;
console.log(`Your ProductId is: ${productId}`);
return productId;
} else {
console.error('No products found or API call failed');
return null;
}
} catch (error) {
console.error('Error retrieving ProductId:', error.message);
return null;
}
}
// Call the function to get your ProductId
getProductId();
Alternatively, you can use cURL to get your ProductId:
curl --location --request POST 'https://apisecure.westfax.com/REST/Profile_GetProductList/json' \
--form 'Username="your_username"' \
--form 'Password="your_password"' \
--form 'Cookies="false"'
The response will contain your ProductId in the Id field:
{
"Success": true,
"Result": [
{
"Id": "00000000-1111-2222-3333-4444444444", // This is your ProductId
"Name": "FF-Acme Corp",
"ProductType": "FaxForward",
...
}
]
}
After obtaining your ProductId, initialize the client with all required credentials:
const WestFax = require('westfax');
const client = new WestFax({
username: 'your_username',
password: 'your_password',
productId: 'your_product_id',
baseUrl: 'https://apisecure.westfax.com', // Optional, defaults to this URL
responseEncoding: 'JSON' // Optional, defaults to 'JSON'
});
The package includes several example scripts to help you get started:
examples/get-product-id.js - Demonstrates how to retrieve your ProductId programmaticallyexamples/send-fax.js - Shows how to send faxes to single and multiple recipientsexamples/retrieve-fax.js - Demonstrates how to retrieve and process fax documentsTo run the examples:
examples/.env.example to examples/.env and add your credentialsnode examples/get-product-id.js// Send a fax to a single recipient
const sendFaxResult = await client.sendFax({
jobName: 'Test Fax',
header: 'Test Header',
billingCode: 'Customer Code 1234',
numbers: '800-555-1212', // Single string for one recipient
file: '/path/to/document.pdf',
csid: '0000000000',
ani: '0000000000',
faxQuality: 'Fine',
feedbackEmail: 'your@email.com'
});
// Send to multiple recipients (up to 20 max)
// The library will automatically format these as Numbers1, Numbers2, Numbers3, etc.
// as required by the WestFax API
const multipleNumbersResult = await client.sendFax({
jobName: 'Multiple Recipients',
header: 'Important Document',
numbers: ['800-555-1212', '800-555-1213', '800-555-1214'], // Array of recipients (max 20)
file: '/path/to/document.pdf'
});
// Send with a file buffer
const fs = require('fs');
const fileBuffer = fs.readFileSync('/path/to/document.pdf');
const bufferResult = await client.sendFax({
jobName: 'Buffer Example',
header: 'From Buffer',
numbers: '800-555-1212',
file: fileBuffer,
filename: 'document.pdf' // Optional filename when using buffer
});
// Retrieve a single fax document
const faxId = {
Id: '12345678-1234-1234-1234-123456789abc',
Direction: 'Inbound'
};
const singleDocResult = await client.getFaxDocuments(faxId, 'pdf');
// Retrieve multiple fax documents
const faxIds = [
{ Id: '12345678-1234-1234-1234-123456789abc', Direction: 'Inbound' },
{ Id: '87654321-4321-4321-4321-cba987654321', Direction: 'Outbound' }
];
const multipleDocsResult = await client.getFaxDocuments(faxIds, 'pdf');
// Mark a fax as read
const faxId = {
Id: '12345678-1234-1234-1234-123456789abc',
Direction: 'Inbound'
};
const markAsReadResult = await client.changeFaxFilterValue(faxId, 'Retrieved');
// Delete a fax
const deleteResult = await client.changeFaxFilterValue(faxId, 'Removed');
// Reset filter (mark as unread)
const resetResult = await client.changeFaxFilterValue(faxId, 'None');
const faxId = {
Id: '12345678-1234-1234-1234-123456789abc',
Direction: 'Inbound'
};
const faxDescription = await client.getFaxDescriptionsUsingIds(faxId);
// Get products with unread faxes
const unreadFaxProducts = await client.getProductsWithInboundFaxes('None');
// Get products with read faxes
const readFaxProducts = await client.getProductsWithInboundFaxes('Retrieved');
const productList = await client.getF2EProductList();
The package includes comprehensive tests for all API methods.
Important Note: There is no "mock" API for WestFax - all API calls go to the production environment. When running tests, real credentials are required, and actual API calls will be made.
To run tests with your WestFax credentials:
.env file in the project root (or copy from .env.example)WESTFAX_USERNAME=your_username
WESTFAX_PASSWORD=your_password
WESTFAX_PRODUCT_ID=your_product_id
npm test
For integration tests that send real faxes, you can also set:
TEST_FAX_NUMBER=your_test_fax_number
TEST_FAX_FILE=path_to_test_file.pdf
Since all API calls are to the production environment, be careful when running tests:
If you prefer to avoid actually sending faxes during testing, you can modify the test cases to skip the actual sendFax tests.
If you need assistance or have questions about the WestFax API, please contact WestFax support directly.
new WestFax(config)Creates a new WestFax client instance.
config (Object): Configuration options
username (String): WestFax API usernamepassword (String): WestFax API passwordproductId (String): Default product ID to use for operationsbaseUrl (String, optional): API base URL (default: 'https://apisecure.westfax.com')responseEncoding (String, optional): Response format (default: 'JSON')cookies (Boolean, optional): Whether to use cookies (default: false)getProductId()Helper method to retrieve the first available ProductId for your account. This is useful when setting up the client for the first time.
Returns: Promise resolving to the ProductId string or null if none found
getProductList()Gets a list of all products the user has access to.
Returns: Promise resolving to API response object with a Result array containing product information
getF2EProductList()Gets a list of fax-to-email products the user has access to.
Returns: Promise resolving to API response object with a Result array containing product information
sendFax(options)Sends a fax to one or more recipients.
options (Object): Fax options
jobName (String, optional): Name of the fax jobheader (String, optional): Header to display on the faxbillingCode (String, optional): Billing codenumbers (String|Array): Destination fax number(s)
file (String|Buffer|Stream): File to fax (path, buffer, or stream)filename (String, optional): Filename when using buffer or streamcsid (String, optional): CSID (Caller Service ID)ani (String, optional): ANI (Automatic Number Identification)startDate (String, optional): Start date for the faxfaxQuality (String, optional): Fax quality ('Fine' or 'Normal')feedbackEmail (String, optional): Email for status notificationscallbackUrl (String, optional): Callback URL for status updatesReturns: Promise resolving to API response object
getFaxDocuments(faxIds, format)Retrieves fax documents.
faxIds (Object|Array): Fax identifier(s)format (String, optional): Document format (default: 'pdf')
Returns: Promise resolving to API response object
changeFaxFilterValue(faxIds, filter)Changes the filter value of faxes.
faxIds (Object|Array): Fax identifier(s)filter (String): Filter value
Returns: Promise resolving to API response object
getFaxDescriptionsUsingIds(faxIds)Gets detailed descriptions of faxes.
faxIds (Object|Array): Fax identifier(s)Returns: Promise resolving to API response object
getProductsWithInboundFaxes(filter)Gets products with inbound faxes matching a filter.
filter (String, optional): Filter to apply (default: 'None')
Returns: Promise resolving to API response object
MIT
FAQs
Interact with the WestFax Secure Cloud Fax API to send and receive faxes.
The npm package westfax receives a total of 0 weekly downloads. As such, westfax popularity was classified as not popular.
We found that westfax demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.