This package is not maintained by Eligible.com. NextStep LLC saw a need for an updated NodeJS wrapper, and created this package.
npm install eligible-node-typescriptThis package is not maintained by Eligible.com. NextStep LLC saw a need for an updated NodeJS wrapper, and created this package.
Node.js typescript bindings for Eligible APIs (https://eligible.com). Eligible is built for developers needing HIPAA compliant connectivity to health insurance companies.
You can request an account at https://eligible.com/request-access
* Documentation
* Requirements
* Installation
* Usage
* Create instance
* Test Mode
* Example
* Coverage
* Retrieve Coverage
* Retrieve Medicare
* Retrieve Cost Estimates
* Payment
* Payment Status
* Claim
* Create a Claim
* Retrieve Single Claim Acknowledgements
* Retrieve Multiple Claims Acknowledgements
* Retrieve Single Claim Payment Report
* Retrieve Specific Claim Payment Report
* Retrieve Multiple Claim Payment Report
* Realtime Adjudication & Estimate
* Payer
* List All Payers
* View a Payer
* Search Options
* Search Options of a Payer
* Customer
* Create a Customer
* Update a Customer
* View a Customer
* List Customers
* Enrollment
* Create an Enrollment
* Update an Enrollment
* Retrieve an Enrollment
* List Enrollments
* Received PDF
* View Received PDF
* Download Received PDF
* Original Signature PDF
* Create Original Signature PDF
* Update Original Signature PDF
* View Original Signature PDF
* Delete Signature PDF
* Download Signature PDF
* Referral
* Referral Inquiry
* Create A Referral
* Precertification
* Precertification Inquiry
* Create A Precertification
* x12
* Simple Post
* MIME Post
* Tickets
* Create a Ticket
* View a Ticket
* Update a Ticket
* List Tickets
* Create a Ticket Comment
* List Comments for a Ticket
* Errors
* Testing
* Developing
* Support Forums
Refer to https://eligible.com/rest for full documentation on Eligible APIs, their request parameters
and expected response formats.
Node.js 0.12 and above
``sh`
npm install eligible-node --save
First create an Eligible object by passing your api key. You can pass the api key directly or as an object. You may also load your api key from environment variables.
`js
var Eligible = require('eligible-node');
// Get values from environment variables if nothing is passed in arguments
// available env variables: ELIGIBLE_API_KEY, ELIGIBLE_IS_TEST
var eligible = Eligible();
//or, pass them as object:
var eligible = Eligible({
apiKey: 'foobar',
isTest: true
});
//or, pass Config object
var config = new Eligible.Config;
config.setApiKey('foobar')
config.setTest(true);
var eligible = Eligible(config);
`
To make the Eligible as explorable as possible, accounts have test-mode as well as live-mode. See above example to enable test mode on any of your requests and hit the sandbox.
Complete example on how to use the library:
`js
var Eligible = require('eligible-node');
var eligible = Eligible({
apiKey: 'n5Cddnj2KST6YV9J2l2ztQQ2VrdPfzA4JPbn',
isTest: true
});
// Retrieve a payer and it's search options
eligible.Payer.retrieve('62308')
.then(function(payer){
console.log(payer.payer_id);
return payer.searchOptions(); //retrieve search options
})
.then(function(searchOptions){
console.log(searchOptions)
})
.catch(Eligible.APIConnectionError, function(e){
console.log('Connection Error');
})
.catch(Eligible.AuthenticationError, function(e){
console.log('Authentication Error', e.message, e.code, e.response);
})
.catch(Eligible.InvalidRequestError, function(e){
console.log('InvalidRequestError', e.message, e.code, e.response);
})
.catch(function(e){
console.log(e);
});
`
See Errors for a list of Error types.
#### Retrieve Coverage
`js`
eligible.Coverage.all({
payer_id: '00001',
provider_last_name: 'Doe',
provider_first_name: 'John',
provider_npi: '0123456789',
member_id: 'ZZZ445554301',
member_first_name: 'IDA',
member_last_name: 'FRANKLIN',
member_dob: '1701-12-12',
service_type: '30',
})
.then(function(coverage) {
console.log(coverage)
})
.catch(function(e) {
//
});
#### Retrieve Medicare
`js`
eligible.Coverage.medicare({
provider_npi: '0123456789',
member_id: 'ZZZ445554301',
})
.then(function(medicare) {
console.log(medicare);
})
.catch(function(e) {
//
});
`js`
eligible.Coverage.costEstimates({
provider_npi: '0123456789',
provider_price: '1500.50',
service_type: '1',
network: 'IN',
})
.then(function(costEstimates) {
console.log(costEstimates);
})
.catch(function(e) {
//
});
#### Payment Status
`js
eligible.Payment.status({
payer_id: '00001',
provider_last_name: 'Doe',
provider_first_name: 'John',
provider_npi: '0123456789',
member_id: 'ZZZ445554301',
member_first_name: 'IDA',
member_last_name: 'FRANKLIN',
member_dob: '1701-12-12',
payer_control_number: 123123123,
charge_amount: 125.00,
start_date: '2010-06-15',
end_date: '2010-06-15',
trace_number: 'BHUYTOK98IK',
})
.then(function(payment) {
console.log(payment)
})
.catch(function(e) {
});
`
#### Create a Claim
`js`
eligible.Claim.create(params) // example params can be found in the REST document of this endpoint
.then(function(claim) { // returns a claim instance
console.log(claim);
return claim.acknowledgements(); // get acknowledgements for this claim
})
.then(function(acknowledgements){
console.log(acknowledgements);
})
.catch(function(e){
//
});
#### Retrieve Single Claim Acknowledgements
`js`
eligible.Claim.getAcknowledgements('12121212')
.then(function(data) {
console.log(data);
})
or, using claim instance either created manually or returned by Claim.create() method
`js`
var claim = new eligible.Claim({'reference_id': '12121212'});
claim.acknowledgements()
.then(function(data) {
console.log(data);
})
#### Retrieve Multiple Claims Acknowledgements
`js`
eligible.Claim.queryAcknowledgements(query)
.then(function(data) {
})
#### Retrieve Single Claim Payment Report
`js`
eligible.Claim.getPaymentReport('BDA85HY09IJ')
.then(function(payment) {
})
or, using claim instance either created manually or returned by Claim.create() method
`js`
var claim = new eligible.Claim({'reference_id': 'BDA85HY09IJ'});
claim.paymentReports()
.then(function(payment_report) {
console.log(payment_report);
})
#### Retrieve Specific Claim Payment Report
`js`
eligible.Claim.getPaymentReport('BDA85HY09IJ', 'ABX45DGER44')
.then(function(payment) {
})claim
or, using instance either created manually or returned by Claim.create() method
`js`
var claim = new eligible.Claim({'reference_id': 'BDA85HY09IJ'});
claim.paymentReports('ABX45DGER44')
.then(function(payment_report) {
console.log(payment_report);
})
#### Retrieve Multiple Claim Payment Report
`js`
eligible.Claim.queryPaymentReports(query)
.then(function(data) {
})
#### Realtime Adjudication & Estimate
`js`
eligible.Claim.realtime(params) // example params can be found in the REST document of this endpoint
.then(function(data) {
})
.catch(function(e){
});
#### List All Payers
`js`
eligible.Payer.all({
endpoint: 'coverage',
})
.then(function(payers) {
console.log(payers);
})
#### View a Payer
`js`
eligible.Payer.retrieve('62308')
.then(function(payer) {
return payer.searchOptions()
})
//retrieve search options for this payer
.then(function(searchOptions){
console.log(searchOptions)
})
.catch()
#### Search Options
`js`
eligible.Payer.searchOptions()
.then(function(searchOptions) {
console.log(searchOptions)
})
#### Search Options of a Payer
`js`
eligible.Payer.searchOptions('62308')
.then(function(searchOptions) {
})payer
or, using instance either:
`js`
var payer = new eligible.Payer({payer_id: '62308'});
payer.searchOptions()
.then(function(searchOptions) {
console.log(searchOptions);
})
#### Create a Customer
`js`
eligible.Customer.create({
customer: {
name: 'ABC company',
},
})
.then(function(customer) {
console.log(customer.id);
})
.catch();
#### Update a Customer
`js`
eligible.Customer.update('TN344YY67HH09KK', {
customer: {
name: 'XYZ company',
},
})
.then(function(customer) {
console.log(customer.id);
})
.catch(done);
#### View a Customer
`js`
eligible.Customer.get('TN344YY67HH09KK')
.then(function(customer) {
console.log(customer.id);
})
.catch();
#### List Customers
`js`
eligible.Customer.all({
page: 1,
})
.then(function(data) {
console.log(data.customers);
})
.catch();
#### Create an Enrollment
`js`
eligible.Enrollment.create(params) // example params can be found in the REST document of this endpoint
.then(function(enrollment) {
console.log(enrollment);
})
.catch();
#### Update an Enrollment
`js`
eligible.Enrollment.update(params) // example params can be found in the REST document of this endpoint
.then(function(enrollment) {
console.log(enrollment);
})
.catch();
`js`
eligible.Enrollment.get(123)
.then(function(enrollment) {
console.log(enrollment);
})
.catch();
#### List Enrollments
`js`
eligible.Enrollment.all({
page: 1,
})
.then(function(data) {
console.log(data.enrollment_npis);
})
.catch();
#### View Received PDF
`js`
eligible.Enrollment.viewReceivedPDF('123')
.then(function(receivedPDF) {
console.log(receivedPDF.download_url);
})
.catch();
Returns a readable stream when successful
`js`
eligible.Enrollment.downloadReceivedPDF('123')
.then(function(pdf) {
pdf.pipe(fs.createWriteStream('./received_pdf.pdf'))
})
.catch();
#### Create Original Signature PDF
You can either pass a path to PDF or a readable stream of the pdf file:
`js`
eligible.Enrollment.createOriginalSignaturePDF('123', {
file: './upload.pdf',
})
.then(function(originalSignaturePDF) {
console.log(originalSignaturePDF.download_url);
})
.catch();
#### Update Original Signature PDF
You can either pass a path to PDF or a readable stream of the pdf file:
`js`
eligible.Enrollment.updateOriginalSignaturePDF('123', {
file: './upload.pdf',
})
.then(function(originalSignaturePDF) {
console.log(originalSignaturePDF.download_url);
})
.catch();
#### View Original Signature PDF
`js`
eligible.Enrollment.viewOriginalSignaturePDF('123')
.then(function(originalSignaturePDF) {
console.log(originalSignaturePDF.download_url);
})
.catch();
#### Delete Signature PDF
`js`
eligible.Enrollment.deleteOriginalSignaturePDF('123')
.then(function(response) {
console.log(response.message);
})
.catch(done);
Returns a readable stream when successful
`js`
eligible.Enrollment.downloadOriginalSignaturePDF('123')
then(function(pdf) {
pdf.pipe(fs.createWriteStream('./original_signature_pdf.pdf'))
})
.catch();$3
#### Referral Inquiry
`js`
eligible.Referral.inquiry({
payer_id: '60054',
payer_name: 'Aetna',
provider_type: 'attending',
provider_last_name: 'Doe',
provider_first_name: 'John',
provider_npi: '0123456789',
provider_phone_number: '1234567890',
provider_taxonomy_code: '291U00000X',
member_id: 'ZZZ445554301',
member_first_name: 'IDA',
member_last_name: 'FRANKLIN',
member_dob: '1701-12-12',
from_date: '2014-01-01',
to_date: '2015-01-01',
})
.then(function(referral) {
})
.catch(done);
#### Create A Referral
`js`
eligible.Referral.create(params) // example params can be found in the REST document of this endpoint
.then(function(referral) {
})
.catch(done);
`js`
eligible.Precertification.inquiry({
payer_id: '60054',
payer_name: 'Aetna',
provider_type: 'attending',
provider_last_name: 'Doe',
provider_first_name: 'John',
provider_npi: '0123456789',
provider_phone_number: '1234567890',
provider_taxonomy_code: '291U00000X',
member_id: 'ZZZ445554301',
member_first_name: 'IDA',
member_last_name: 'FRANKLIN',
member_dob: '1701-12-12',
from_date: '2014-01-01',
to_date: '2015-01-01',
})
.then(function(precert) {
})
.catch(done);
#### Create A Precertification
`js`
eligible.Precertification.create(params) // example params can be found in the REST document of this endpoint
.then(function(precert) {
})
.catch(done);
#### Simple Post
`js`
eligible.config.setApiVersion('v1.1');
eligible.X12.post(params)//
.then(function(x12) {
})
.catch(done);
#### MIME Post
`js`
eligible.config.setApiVersion('v1.1');
eligible.X12.mimePost(params)//
.then(function(x12) {
})
.catch(done);
#### Create a Ticket
`js
eligible.Ticket.create(params)
.then(function(ticket) {
})
.catch();
`
#### View a Ticket
`js
eligible.Ticket.retrieve('123')
.then(function(ticket) {
})
.catch();
`
#### Update a Ticket
`js
eligible.Ticket.update('123', params)
.then(function(ticket) {
})
.catch();
`
#### List Tickets
`js
eligible.Ticket.list()
.then(function(data) {
})
.catch();
`
#### Create a Ticket Comment
`js
eligible.Ticket.createComment('123', params)
.then(function(comment) {
})
.catch();
`
#### List Comments for a Ticket
`js
eligible.Ticket.comments('123')
.then(function(comments) {
})
.catch();
`
The library throws following error objects.
- Eligible.APIConnectionError
- Eligible.APIResponseError
- Eligible.APIError
- Eligible.AuthenticationError
- Eligible.InvalidRequestError
The following table describes the properties of the error object.
| Property | Type | Description |
|:----------:|:----------------:|:-------------------------------------------------------------------:|
| message | string | The error message |code
| | number | When the error occurs during an HTTP request, the HTTP status code. |response
| | object or string | HTTP response as JSON, if JSON not available raw response is stored |
To catch individual errors, use bluebird catch syntax.
Use the following commands to run tests or test coverage:
`sh`
ELIGIBLE_API_KEY=API_KEY npm test
ELIGIBLE_API_KEY=API_KEY npm run coverage
Note that, by default running above commands will mock HTTP requests using nock library. To disable mocking and make actaul calls against eligible server, pass NOCK_OFF=true enviroment variable:
NOCK_OFF=true npm test
To filter tests, update grep field in test/mocha.opts.
To work on the library:
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)
3. Install dependencies: npm installnpm run lint
4. Fix bugs or add features. Make sure the changes pass the coding guidelines by runing: or npm run watchnock
5. Write tests for your new features. For HTTP mocking library is used. Nock definitions are saved in test/fixtures directorynpm test
6. Run test by or npm run coverage`
7. If all tests are passed, push to the branch (git push origin my-new-feature)
8. Create new Pull Request
If you find an issue with in the client library we would appricate you Send an email to support@eligible.com or add an issue in the Issue tracker for bug reports.