Topics on this page

Print documents using BriteAPIs

BriteCore users can use BriteCore’s print solution, Titanium Blizzard, or outsource with a third-party print solution provider, such as MassPrinting or O’Brien Insurance solutions, to print documents using BriteAPIs.

Printing in BriteCore occurs nightly. When printing occurs, BriteCore automatically updates the document’s print date to the day the document is sent to the printer. If a user manually prints a document and sets the print state to printed, BriteCore adjusts the print date to the same day.

Printing through BriteAPIs occurs in the following broad steps:

  1. Retrieve the identifying information of each file you need to print.
  2. Retrieve the actual files you need to print using the identifying information.
  3. Update the print state for all the files that were successfully retrieved.
  4. Send a summary email with a list of printed documents.

In this tutorial, we will cover key concepts related to printing in BriteCore and detail the steps to print using an API.

Key concepts

  • Deliverable: In BriteCore, we use the term deliverable to refer to any document that you format, and potentially print and mail, to a number of parties regarding a policy, such as declarations, invoices, or statements.
  • Form: A special kind of deliverable with wording and layout constraints. Examples of forms include riders, endorsements, or applications. Forms are usually printed with a declaration to form a policy binder.
  • Policy print: A process that runs each night to print all paper deliverables for clients.
  • Certificate of mailing: A state-mandated document that proves you sent the items by registered mail. In BriteCore, this is a standard report that shows which printed deliverables need to be certified by the United States Postal Service validating that the information was mailed to the insured. An example document that may require a certificate of mailing is a cancellation notice.

Using BriteAPIs to print

Note: Blocks of code are hidden by default to make the page more navigable. Select View code and Hide code to view or hide these sections as needed.

Step 1: Get a security token

You will need to request an ID and Secret to use OAuth 2.0.

For more information, refer to How do I get started?

Step 2: Use getToBePrinted to retrieve files to print

To retrieve files that need to be printed, use the getToBePrinted (/v1/printing/getToBePrinted) endpoint.

The request parameters include:

  • from_date: The earliest date to retrieve files from. Should be formatted YYYY-MM-DD. Defaults to the client’s live date.
  • to_date: The latest date to retrieve files from. Should be formatted YYYY-MM-DD. Defaults to today’s date.
  • ignore_state: (optional) Ignore the file’s print state. Defaults to False.
  • exclude_electronic_delivery: Defaults to False; excludes documents that should be delivered electronically.
  • only_electronic_delivery: Defaults to False; only returns documents that should be delivered electronically.
  • include_claims: Defaults to False; if passed as True, any claim deliverables with TBD print state get returned within the same batch. Fields for claim deliverables are exactly the same for policy.

The return payload includes: 

  • processing: Whether or not nightly processing for the to_date is processing, done, or not started.
  • files: A list of objects with the policy number, file ID, date it should print, label, and title, parent ID or children IDs.

Sample request

View code
curl --location --request POST '/api/v1/printing/getToBePrinted' \
--header 'Authorization: ' \
--header 'Content-Type: text/plain' \
--header 'Cookie: webpy_session_id=ba29bb0947f3f6e1659cb47514e18617dd85e2a3' \
--data-raw '{"ignore_state": "do not print",
"from_date": "20000101",
"to_date": "2013-05-21",
"exclude_electronic_delivery":"False",
"only_electronic_delivery":"False",
"include_claims":"True"
}

Sample response

View code

{'processing': 'done',
'files': [{'policy_number': '10-2013-42',
'file_id': 'f6b8f1b0-e4b0-4738-b96d-51c270c76580',
'contact_id': 'c4e448ea-6494-439f-94eb-829a05f8f9f2',
'print_date': '2013-05-21',
'print_state': 'tbd',
'label': 'Declaration',
'title': '10-2013-42 - Declaration',
'batch': page_range(1,5)},
{'policy_number': '10-2013-42',
'file_id': '774f0b38-2b49-4d7c-ae0f-19541841fbeb',
'contact_id': 'c7404bb5-3d07-43c1-bc7b-2caffde84330',
'print_date': '2013-05-21',
'print_state': 'tbd',
'label': null,
'title': 'form-m01a32ll.pdf',
'parent': 'f6b8f1b0-e4b0-4738-b96d-51c270c76580',
'batch': ''}
]
}

Take note of the processing key in the above example, which currently shows done. Before printing the day’s print job, you need to check that the value in that field is done. Anything else (incomplete or not started) indicates that nightly processing isn’t finished, and nightly processing creates a fair number of additional print documents.

Step 3: Use getAttachment to retrieve actual files

To get the file for each of the IDs returned by getToBePrinted, you will send API requests to getAttachment (/v1/printing/getAttachment) and as long as the file exists on the server or on s3, it will retrieve its contents, format it as a PDF, and send it back to the client.

Once the result of getToBePrinted returns that processing is done, it is time to loop through the files and fetch each of them.

Sample request

View code
curl --location --request POST '/api/v2/deliverables/get_attachment' \
--header 'Authorization: ' \
--header 'Content-Type: text/plain' \
--data-raw '{
"file_id": "d9b8dfec-94e5-4067-b966-b57fbb3f45b5"

Sample response

Here, we’re just fetching one file and putting into our tmp directory. You will need to loop through the files and fetch all of them.

Step 4: Use markAsPrinted to update the print state

Once the files have been downloaded and either printed or put into a queue where the handoff between the systems is complete, you will want to let BriteCore know that the files should be marked as printed so that you don’t get them any longer when calling getToBePrinted.

Sample request

View code
curl --location --request POST '/api/v1/printing/markAsPrinted' \

--header 'Authorization: \

--header 'Content-Type: text/plain' \

--data-raw '{

"file_ids": ["d9b8dfec-94e5-4067-b966-b57fbb3f45b5", "9fe492f9-d1dc-491a-b374-7adf6b56ea33"]}

}'

Step 5: Use printHawk to send a summary email

Once the files are marked as being printed in the system, BriteCore has an email report that will automatically be sent to the company by calling this function.

View code

Sample Request
curl --location --request POST ‘/api/v1/printing/sendPrintHawkEmail' \

--header 'Authorization: \

--header 'Content-Type: text/plain' \

--data-raw '{}'