Whippy Stock Flow
Last updated
Was this helpful?
Last updated
Was this helpful?
The Whippy Stock flow facilitates the transfer of location-based product stock information between ERP systems and Whippy. This process ensures that stock levels are accurately synchronized between these systems, providing up-to-date data. The flow can operate in two ways: inbound or outbound.
The inbound Whippy Stock flow triggers itself at specific intervals set by the user, such as once every minute, every hour, daily at midnight, every 5th day of the month, etc. It reads data from the ERP system and writes it to Whippy, ensuring that Whippy always has the latest stock information.
The outbound Whippy Stock flow, on the other hand, involves data being pushed directly to the flow from an external source and then written to Whippy.
This dual capability ensures seamless communication and accurate stock management across the entire system.
Inbound Flow: Indicates that the flow will read data from the ERP system. A cron schedule is set up to ensure it runs, for example, every 5 minutes.
Outbound Flow: Signifies that stock data will be posted to the flow from the ERP system, skipping the step of reading data from the ERP system, with outbound flows the data is sent to outbound URLs found in flow configuration using HTTP POST methods, more details can be found at Outbound section.
Login Step: Handles logging into Whippy and (if configured) the ERP system. If an error occurs during this step, the details are logged.
Read Data From ERP Step: For inbound flows, stock queries are made from the ERP system. Outbound flows proceed directly to the next step.
Script Step (Optional): Transformation operations on the data are performed using Python, if required.
Mapping Step (Optional): Transformation operations on the data are performed using the Jolt Transform library. Further details can be found at the website.
Write Data to Omnitron Step: The incoming data is divided into rows and written to Whippy. Logs are created for each row. In case of an error, details of the error are logged (e.g., the relevant product is not found in Omnitron). Successful operations are also logged.
Trigger Settings: Configures the key values to be used for single and date-based queries from ERP. sku
and modified_date__gt
are created by default and are required values. These settings are used in the trigger page to use specific parameters while creating the trigger URL. modified_date__gt
value is also used while creating automatic inbound request URLs and sku
value is used on “Fetch Missing” tasks for querying missing SKUs on ERP.
Adding a New Query Parameter:
Using Newly Added Parameters:
Effects of the Custom Parameters:
Using with SKU:
Using with Modified Date:
Whippy Settings:
Timezone Settings: Timezone used for date-based queries from ERP, this value is used with inbound task requests to modify modified_date__gt
value for a specific timezone. The date time format is following: yyyy-MM-dd'T'HH:mm:ss.SSSSSS
, ex: 2024-12-31T13:30:59.000001
Add Extra Headers as Dict Format: During the stock query from ERP, additional headers to be sent.
Extra Params: Additional parameters used when ERP request is made, it must be a valid dict if a GET request is made which will be used to send query parameters in the URL or it can be used on a POST request in which the extra params value will be used to be sent in request body.
Endpoint URL: URL for reading data from the ERP system.
HTTP Method: GET
or POST
Pagination:
Offset pagination is a method where a fixed number of items are retrieved from a data source in each request, starting from a specified offset. This offset indicates the position from which to begin fetching data.
Seek pagination relies on a unique identifier or a specific value to retrieve subsequent sets of data. Instead of using offsets, it uses a marker or token indicating where the previous set of data ended.
Next field pagination includes a "next" field or token in each server response that points to the next page of data.
This is a basic script, and the process steps within it can be updated to activate the use of each script step.
Scripts can read incoming data from the inputStream
, where the variable input_text
contains a JSON string. This string should be parsed using Python's json
library. Any outgoing data is written using the outputStream.write()
method after converting the relevant Python object back into a JSON string.
Additionally, the script allows for the use of attributes, which provide supplementary information tied to the current execution process. These attributes can be freely accessed or modified throughout the script. For example, the get_attribute()
function is used to read attribute values, while the session.putAttribute()
method is used to write new string attribute values. Each attribute consists of a key-value pair, where the key
uniquely identifies the attribute, and the value
can be referenced in subsequent steps.
Attributes with keys starting with the prefix log.
will be automatically logged at the end of the execution if a log file is generated, ensuring that important information is captured and available for later review.
Example Script:
Script Testing:
The response from ERP is placed in the input field, and the result of the script is viewed in the result field.
Example Input:
Expected Output:
Mapping Testing: The response from the script is placed in the input field, and the result of the mapping is viewed in the result field.
POST
Write Data to OmnitronPath: /api/v1/stocks/insert_or_update_stock/
Example POST Request From Integrator to Omnitron:
In outbound flows, triggers will be configured to send a POST request to the URL specified in the "Outbound Request URL" setting under the Configuration card. The content of the POST request will include JSON data containing details such as SKU, stock, location id and provider info for each product.
Expected Payload:
It is still possible to use Script and Mapping steps to transform data according to expected payload but at the end of those steps the expected payload structure is the following:
Domain URL: Whippy’s domain URL, Example:
Dynamic URLs are used when the url structure, path changes based on different conditions or if the URL doesn’t fit a standard REST API structure. In the example below, the URL changes if the request is going to be a “date” based query or “sku” based query and at the same time the API requires the ERP token to be in the URL itself. Using language it is possible to change the request URL in the run time based on conditions and expressions written in the URL field.
Details can be found at the website. Because after this step the input data will be separated to different order rows, the flow expects the following output to be an array of order objects.