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.
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,
- Create an export from Hubspot.
- Configure essential details as shown.
- Preview the exported data. Note that the exported data contains record IDs that are required for the next step in the flow.
Step 2 – Get the deal attachments/files
To add the deal attachments,
- Create a lookup for attachments/files using Look up additional records (per record).
- 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.
- 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.
- Add an output filter and define a rule to merge the field into the source record only if an attachment ID exists.
- 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: [] } }
- 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.
Step 3 – Generate pre-signed file URLs and download the BLOB files
To generate pre-signed file URLs,
- Create a lookup for file URLs using Look up additional records (per record).
- 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).
- 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.)
- 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.
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,
- Create a transfer (community post).
- Configure the essential details as shown. Metadata field details help to place the files in NetSuite with the correct name and extension.
Execute the flow by clicking the Run 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.
Comments
Please sign in to leave a comment.