Email a Stock Report

This workflow describes how to use the OFN API to query the products in stock and send a simple stock report to a user, either when you trigger the workflow manually, or on a regular schedule eg weekly.


This integration queries the OFN Bulk Products API to compile an Excel spreadsheet containing information about all products the authenticated user has access to. The spreadsheet contains:

  • Producer Name

  • SKU

  • Product/Variant Name

  • Stock levels - either 'unlimited' or an integer quantity

  • Price

The spreadsheet is then emailed to a given email address with a configurable email subject and content at a specified schedule.


To set up this integration you will need:


Find the workflow code for download and import here.


Video tutorial coming soon. If this would be helpful to you please let us know in the #n8n channel on our Slack.

  • Click Workflows > Import from file. Import the following json file

  • The workflow is imported. Every block is a "node": an entry point for retrieving data, a function to process data, or an exit for sending data. The nodes are connected to each other to form a "workflow". You can access the details of each node by double clicking on it.

The "Email a stock report" workflow allows you to :

1/ trigger a request periodically to OFN API

2/ to get a user products' stock information

3/ save this information in variables

4/ and put them in a spreadsheet file

5/ then send this spreadsheet file to the user's email.

  • The first node of the workflow is Cron: it is the node that will trigger the workflow periodically. Double click on it if you want to change the periodicity (weekly, daily, etc..).

  • FYI, the Start node exists by default, can't be deleted, and will serve to start the workflow if there's no other trigger node (won't be used in our case).

  • The HTTP request node will do the request to OFN API. You have to change the URL and add your credentials for authentication. Double click on the node.

  • Under "Credential for Header Auth", click "Create New"

  • Rename the credential as you wish, then :

Name : X-Spree-Token

Value : API key of the OFN user you want to send the stock report to (the instance manager can find it in Superadmin > Users).

  • In the "URL" field, change the part corresponding to your instance

  • Done ! To save, just click on "Back to canvas" or outside the box.

  • Now double click on the SendGrid node.

  • In "Credential for SendGrid API", click "Create New".

Enter the credential you've created in SendGrid ( > "Create API Key")

  • In "Recipient Email" field, enter the user's email. Then click "Back to canvas"

  • In your workflow view, click "Execute workflow"

  • If all went well, you'll have green icons appearing for each successful node.

  • If you want to see the details of what happened in each node, and what data were passed from one node to another, double click on the node. For instance, click on the HTTP Request node to see the GET response (you can switch to JSON view).

  • If there was an error, a red icon will appear on the node, and an error message will be displayed. To get the details, double click on the node. To test if a specific node is executing correctly, you can execute each node individually by double clicking on it and clicking "Execute node", or on the main workflow page by hovering on the node and clicking on the "play" icon.

  • When you're good, rename your workflow and save.

  • You can access all the workflows you've created by clicking on Workflows > Open

  • Et voilà, have fun! 🎉

Last updated