Functions let you interact with your connected tool’s API to retrieve specific information before send a request (webhook) to K inventory. For example, they can retrieve a category or product identifier and include it in your queries.
How do you create a function?
1. Go to Functions
-
- In the K inventory main menu, click on the “PARAMETERS” TAB..
- In the “Automation” sectionsection, click on on “Functions”..
2. Create a new function
-
- Click on the “TO CREATE A FUNCTION..
- Give your function a clear, descriptive name (e.g. “Retrieve product ID”).
3. Configure your function
-
- Select connection : Choose the connection you have previously configured with the tool whose information you wish to retrieve.
- Select the : Select the appropriate HTTP method for your request (GET, POST, etc.). The list of available methods will depend on your tool’s API capabilities.
-
- Enter the URL : Specify the complete URL of the API your function should call to retrieve the desired information. This URL must point to the specific resource you are targeting (for example, /products/{product_id}).
- Request body (optional): If your method requires additional data (e.g. for a POST request), you can enter it here in JSON format.
- Save and use your function
- Click on “Save” button. Votre fonction est maintenant prête à être utilisée dans vos requêtes sortantes (webhooks).
Key points to remember
- The functions are executed before the webhook request is sent.
- They allow you to retrieve dynamic data from your tool and include it in your queries.
- Make sure you understand your tool’s API documentation to build the URL and request body of your function correctly.