In this article:
- Overview
- Utilizing the Merge Documents Adapter in a Flow
- Filtering Attachments
- Verifying File Attachments
Overview
The Chain.io Merge Documents adapter was designed to make file transfer and accessibility more convenient in the supply chain data transfer process. This adapter can receive a regular file type, such as a file sent in an email sender, or a JSON file, extract the embedded information, and export the data into separate files. Send document packet and receive document packet Flow types are supported within different Integration types on the Chain.io platform. You can have easy access to files, whether a customer is sending or receiving data.
Merge Documents Adapter Compatibility
| Integration Types | Receive Document Flow Type | Send Document Flow Type |
| Freight Operations | X | X |
| Agent Operations | X | X |
| Carrier Operations | X | |
| Custom Operations | X | |
| Data Aggregation | X | |
| Purchase Order Management Automation | X |
A PDF file combination method is appropriate for the destination file type when the order of the files being downloaded is important. An attachment order can be specified to organize the files in a different order than the order in which they were uploaded. Otherwise, a ZIP file combination method can be used and will return the files in the order in which they were uploaded.
Utilizing the Merge Documents Adapter in a Flow
Follow the steps below to utilize the Merge Documents adapter in a Flow:
- At the top menu bar, click Workspaces and select the Workspace of choice.
- At the top menu bar, click Integrations and select the Integration of choice.
- At the top right of the screen, click Integration Settings from the hamburger menu.
On the Integration Settings page, existing Flows will appear within the table. To edit an existing Flow, click Edit on the right of the Flow’s row. To create a new Flow, scroll to the bottom of the table and click the blue Add New Flow button.
For more information on how to create a Flow, refer to our Creating a Basic Flow support article.

- Within the Flow configuration settings page, scroll down to the Source File Type and click to expand this region.
Select a File type.
Send Document Packet Example
The following example displays source file type options for the Agent Ops Integration and the Send Document Packet Flow designation.

The following example uses Chain.io Shipment JSON as the source file type.

Receive Document Packet Example
The following example displays source file type options for the Agent Ops Integration and the Receive Document Packet Flow designation.

The following example uses Passthrough as the source file type.

Click Destination File Type to open the configuration settings options.

- In the Required Attachments subsection, address the specifications below:
Adding Files
At the bottom right of the Required Attachments subsection, click the blue add button to add a file to the attachment order list.
Attachment Type The following example uses “BOL” as the attachment type.

The possible attachment types are:
File Name Regex The regex is used for the system to identify the file name within the JSON input file.
The following example uses “/.*BOL.*\.pdf/i” as the file name regex.

Removing a File
If necessary, remove a file attachment by clicking the red remove button on the right of the file attachment row.
Missing Required Attachments If required attachments are specified, Flow executions that are missing required attachments will return a failed execution status.
Specify the combination method.
The possible combination methods are:
- Do not combine attachment files.
Combine all attachments into a single PDF document packet.
This selection provides a PDF of the attached files in the order of the list specified in the attachment order subsection.
- Combine all attachments into a single ZIP document packet.
This selection has no impact on the ordering of the attached files.
The attachment type only applies if the input is a Chain.io JSON-formatted file.

Specify the attachment order.
The attachment order is only relevant for the document packet if the combination method selected is “a single PDF document packet.”
Example 1 - PDF Document Packet Attachment Order
Combination Method: Combine all attachments into a single PDF document packet. Files are uploaded in the following order:
- File 1 = INV
- File 2 = BOL
- File 3 = DEC
File attachment order:
- BOL
- DEC
- INV
Files are output in a PDF in the following order:
- File 1 = BOL
- File 2 = DEC
- File 3 = INV
Example 2 - ZIP Document Packet Attachment Order
Combination Method = Combine all attachments into a single ZIP document packet. Files are uploaded in the following order:
- File 1 = INV
- File 2 = BOL
- File 3 = DEC
File attachment order: N/A
Files are output in a ZIP file in the following order:
- File 1 = INV
- File 2 = BOL
- File 3 = DEC
Adding Files
At the bottom right of the Attachment Order subsection, click the blue add button to add a file to the attachment order list.
List Files
List the file attachments in the order in which they will appear within the generated output PDF file. Provide the attachment type and file name regex for each file.
Removing a File If necessary, remove a file attachment by clicking the red Remove button on the right of the file attachment row. The following example lists 3 file attachment types: BOL (bill of lading), DEC (declarations), and INV (invoice)

- Within the Actions menu on the right side of the page, click Save to save your Flow configuration settings.
- Within the same menu, click Deploy to implement the configuration.
- Ensure that the Flow is enabled. Within the same menu, click Enable Flow if the Flow is currently disabled.
Filtering Attachments
- Use the Exclude Attachments to filter out attachments by type or file name (using regular expressions)
- Use the Multiple Attachment Type Retention Logic dropdown to instruct the adapter to discard old version of the same document before assembling the packet.
Verifying File Attachments
Traditionally, an attachment type code determines the file attachment. In the case of the Merge Documents Adapter, file names are used instead of attachment type codes.
To verify that the file attachments were processed correctly, follow the steps below:
At the top menu bar, click Search. The page refreshes with a list of Flows associated with the selected Integration.

Select view on the right of the Flow’s row. The page refreshes with the Flow’s execution summary.
Example
The Flow was executed successfully because a file attachment was specified in the Flow configurations, and it was included correctly with the Flow parameters.

Scroll down to the Files subsection.

Click the download icon to download the generated files, or click the eye icon to view the file within the platform.
Example
Clicking the eye icon opened the file below. The regex sought and found “BOL” within the JSON input file and was able to separate this file to be available for download as a ZIP file.

Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article