NCOA responses

Customers must meet certain requirements to access this additional NCOA functionality. Please review the below and reach out to your Account Manager to see if you are eligible.

Prerequisites

In order to leverage Lob’s NCOA feature, we must have a signed Processing and Acknowledgement Form and the account must meet other volume requirements. If NCOA reporting is not currently enabled for your account, please reach out to your Account Manager or your Customer Success Manager for more information and next steps.

A live API key is also required. In order to get this, refer to step one of Getting Started.

How to use Lob’s NCOA functionality

Using the NCOA data is simple. When an address is created in the Lob API and a mail piece is created, the recipient and address are used to look up current change of address records.

If there is a currently active COA, then the mail piece created will include the recipient’s new address information and the response from the Lob API will include a representation of the Address record that has a recipient_moved value of true and redacted values for address_line1 and address_line2, but all other values will reflect the COA changes.

Code example

For example, an application is sending a check. Because of the business logic of this application, when the recipient has changed addresses, we want to cancel the check instead of allowing it to be rerouted.

For this, we will assume there is a verified bank account already recorded and the application is aware of the Lob record id for that bank account.

import {
    Configuration,ChecksApi, CheckEditable,CountryExtended, AddressEditable 
} from "@lob/lob-typescript-sdk"; 
  
async function demo() { 
    const config: Configuration = new Configuration({ 
        username: "test_XXXXXXXX", 
    }); 
  
    const checkToCreate = new CheckEditable({ 
        description: "Reimbursement $1", 
        to: new AddressEditable({ 
            name: "HARRY ZHANG", 
            address_line1: "185 BERRY ST", 
            address_line2: "SUITE 6100", 
            address_city: "SAN FRANCISCO", 
            address_state: "CA", 
            address_zip: "94107" 
        }), 
        from: new AddressEditable({ 
            name: "LEORE AVIDAR", 
            address_line1: "210 King Street", 
            address_city: "SAN FRANCISCO", 
            address_state: "CA", 
            address_zip: "94107", 
            address_country: CountryExtended.Us, 
        }), 
        bank_account: "bank_XXXXXXXX", 
        amount: 1, 
    }); 
  
    const checksApi = new ChecksApi(config); 
    try { 
        const newCheck = await checksApi.create(checkToCreate); 
        if (newCheck.to?.recipient_moved) { 
            console.log("Recipient has moved - cancel ") 
            await checksApi.cancel(newCheck.id); 
        } 
    } catch (err) { 
        console.error(err); 
    } 
} 
  
demo().then().catch(); 

Conclusion

Lob’s NCOA feature, once enabled for an account, allows a consuming application to more completely manage the behavior of mail pieces when a recipient has moved.

Further resources

Last updated