Articles in this section

Transfer files using an HTTP connection – example flow

The Celigo platform has a convenient option that you can use to transfer files as part of a flow. Enter the Path to file URLs in the HTTP response body in the Non-standard API response patterns section of an HTTP export to download files and transfer them to subsequent flow steps.

Important: The file URLs must be public or self-signed, not requiring authentication.

Here's an example flow to illustrate how we can use the Path to file URLs in the HTTP response body feature.

Example flow – HubSpot to NetSuite

In this example, let's find and download files related to sales deals from HubSpot and transfer them to the NetSuite CRM for further actions that might be required in a deal-based workflow.

Tip: You can click or tap the images shown in the example flow to enlarge them.

Download example flow

example-transfer-files-updated.png

If required, you can download, install, and configure the example flow to view all the settings or better understand how files are transferred, by tweaking and running the flow if you use HubSpot and NetSuite endpoints.

Flow steps – overview

The example flow consists of the following four steps:

S. No. Step name For this step...
1. Get the sales deals from HubSpot Create an export from HubSpot
2. Get the deal attachments/files Create a lookup for attachments/files, then filter, customize using a hook, and map the lookup results into source records 
3. Generate pre-signed file URLs and download BLOB files Create a lookup for file URLs, then map the lookup results into source records

4.

Place the deal files in NetSuite Create a transfer to NetSuite

Step 1 – Get the sales deals from HubSpot

Note: In Steps 1–3, we use an existing HTTP connection named HubSpot. If you don't have an existing HTTP connection to HubSpot, create the connection. You can use this connection if you download and install the example flow.

To get the sales deals,

  1. Create an export from Hubspot.
  2. Configure essential details as shown.
  3. Preview the exported data. Note that the exported data contains record IDs that are required for the next step in the flow.

step1-export-deals.png

Step 2 – Get the deal attachments/files 

To add the deal attachments,

  1. Create a lookup for attachments/files using Look up additional records (per record).
  2. Configure essential fields as shown. Use the HubSpot search API /crm/v3/objects/notes/search and in the HTTP request body, specify the file filter based on deal IDs for record IDs.
  3. Preview the lookup data. Note that the lookup data shows records with the deal attachment details. More actions, such as filtering, transforming, and mapping are performed on this lookup data before it's merged into the source record.

step2-export-attachments.png

  1. Add an output filter and define a rule to merge the field into the source record only if an attachment ID exists.

step2-output-filter.png

  1. Add a hook, that is, a preSavePage script (hubspotNoteAttachmentTransform) to split the attachment IDs if there are multiple IDs and create an array of separate file IDs.
function preSavePage (options) {
  
  let files = [];
  for (let d of options.data) {
    let hs_attachment_ids = d.properties.hs_attachment_ids.split(';');
    for (let a of hs_attachment_ids) {
      files.push({
        id: a
      });
    }
  }
  
  return {
    data: files,
    errors: options.errors,
    abort: false,
    newErrorsAndRetryData: []
  }
}
  1. Finally, map the results – map the data field in the lookup response to a files field in the source record, which is required for the next step.

step2-results-mapping.png

Step 3 – Generate pre-signed file URLs and download the BLOB files

To generate pre-signed file URLs,

  1. Create a lookup for file URLs using Look up additional records (per record).
  2. Configure the essential details as shown. In the Non-standard API response patterns section, make sure to enter Path to file URLs in the HTTP response body. (Here, if required, you can provide comma-separated values when you have more than one file and have to specify more than one path, such as url1, url2).
  3. Preview the lookup data. Note that the lookup data shows the URL and the BLOB file details, which must be mapped. (The below screenshot shows primarily the sections/settings that are populated; it does not show all options.)

step3-generateURL-updated.png

  1. Finally, map the results, that is, map the data.0 field in the lookup response to the metadata field in the source record, which is required for the next step in the flow.

step3-results-mapping.png

Step 4 – Place the deal files in NetSuite

Note: In Step 4, we use an existing NetSuite connection named NetSuite - Celigo Labs. If you don't have an existing NetSuite connection, create the connection. You can use this connection if you download and install the example flow.

To transfer and place the files in NetSuite,

  1. Create a transfer (community post).
  2. Configure the essential details as shown. Metadata field details help to place the files in NetSuite with the correct name and extension.

step4-place-files.png

Execute the flow by clicking the Run button (Run flow button) in the top-right corner of the Flow builder. When the flow run is successfully completed, you can view the files in NetSuite. 

Similarly, based on your requirements, you can create a flow and use the Path to file URLs in the HTTP request body setting to transfer files.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.