01.2 How to send Data into a Scenario
In addition to running a scenario, you may need to send data into the scenario for further processing. Data can be passed in the body of a request (e.g., a POST request) to the URL of a Trigger on Webhook node.
Typically, you'll need to pass JSON objects or various files into the scenario.
A tool for sending POST requests, such as Postman, can be used.
Send JSON Objects
To send JSON using Postman to a Trigger on Webhook node in a scenario, follow these steps:
- Create a scenario containing the Trigger on Webhook node;
- In Postman:
- (1) Select the request method, such as POST;
- (2) Specify the URL of the Trigger on Webhook node as the request target;
- (3) Go to the Body tab and select the Raw format for file transmission;
- (4) Choose the JSON format for the request body;
- (5) Add text in JSON format;
- Save and activate the scenario with the Trigger on Webhook node and, if necessary, click Run Once;
- Send the request containing JSON.
The JSON will be transmitted into the scenario, and the output data of the Trigger on Webhook node will be the parameters of the transmitted JSON object or an array of objects, such as id, gender, etc.
Send Files to a Scenario
To send files using Postman to a Trigger on Webhook node in a scenario, follow these steps:
- Create a scenario containing the Trigger on Webhook node;
- In Postman:
- (1) Select the request method, for example, POST.
- (2) Specify the URL of the Trigger on Webhook node as the request target.
- (3) Go to the Body tab and select the Form-data format for file transmission.
- (4) Define the key Key and the required format as file.
- (5) Add the file as the Value.
- Save and activate the scenario with the Trigger on Webhook node and, if necessary, click Run Once;
- Send a request containing the file.
As a result, the file will be transmitted into the scenario, and the output data of the Trigger on Webhook node will include the file's parameters, such as its name, size, and content.
The content is the main attribute of the file and is often what needs to be specified in the fields of other nodes.