Automatically Log Zendrop Shipping Times into BigQuery for Fulfillment Analytics
This recipe pulls order and shipping data from the Zendrop API and inserts it into a Google BigQuery dataset on a scheduled basis. Data analysts get a continuously updated table of shipping durations ready for reporting and dashboards.
- 1
Schedule the workflow to run hourly
Add a
Schedule Triggernode and set theRuleto run every 1 hour. This kicks off the pipeline automatically so your BigQuery table stays fresh without manual intervention. - 2
Fetch recent orders from the Zendrop API
Add an
HTTP Requestnode. SetMethodto GET andURLtohttps://app.zendrop.com/api/v1/orders. In theAuthenticationsection chooseHeader Authand add your Zendrop API key asAuthorization: Bearer YOUR_API_KEY. Add a query parameterstatusset tofulfilledto fetch only shipped orders. Store your API key in n8n credentials and reference it here. - 3
Transform and calculate shipping duration
Add a
Setnode to extract and reshape the fields you need. Maporder_idfrom{{ $json.id }},created_atfrom{{ $json.created_at }},shipped_atfrom{{ $json.shipped_at }}, andshipping_dayscomputed as{{ Math.round((new Date($json.shipped_at) - new Date($json.created_at)) / 86400000) }}. This gives you a clean flat record per order ready for BigQuery. - 4
Filter out records with missing shipping dates
Add an
IFnode. Set the condition to check that{{ $json.shipped_at }}is not empty. Connect theTruebranch to the BigQuery node so only fully fulfilled orders with a valid ship date are inserted, preventing null errors in your dataset. - 5
Insert shipping time records into BigQuery
Add a
Google BigQuerynode. InOperationselectInsert. SetProject IDto your GCP project,Dataset IDto your target dataset (e.g.zendrop_analytics), andTable IDtoshipping_times. Map the columnsorder_id,created_at,shipped_at, andshipping_daysfrom the previous Set node. Authenticate using a Google Service Account credential with BigQuery Data Editor permissions.
Frequently asked questions
What BigQuery table schema do I need to create before running this workflow?
Create a table named `shipping_times` in your chosen dataset with four columns: `order_id` (STRING), `created_at` (TIMESTAMP), `shipped_at` (TIMESTAMP), and `shipping_days` (INTEGER). You can create this in the BigQuery console or via the bq CLI before the first workflow run.
How do I avoid inserting duplicate rows if the workflow runs every hour?
You can add a query parameter to the Zendrop API call to filter orders by a time window, for example only orders fulfilled in the last 60 minutes using `updated_after`. Alternatively, use BigQuery MERGE statements in a scheduled query to deduplicate on `order_id` after insertion.
What if Zendrop returns paginated results with more than one page of orders?
Zendrop's API returns a `next_page` token in the response. For large catalogs you can extend the workflow by adding a loop using n8n's `Split In Batches` node combined with an additional HTTP Request node to fetch subsequent pages. For most stores a single page of recent fulfilled orders per hour is sufficient.