In the External Request action, you can configure response mapping to write the received data to custom fields. To do this, you need to correctly specify the JSON Path. BotHelp will use this path to search for data in the received response and write it to the specified custom field.
Responses come in JSON format. Let's look at examples of response bodies in JSON format.
1. Simple option. A list of data arrives: one field - one value
{ "name":"Ivan", "age":"30" }
How to write JSON Path to get each of the fields:
$.name
—> «Ivan»$.age
— > «30»
2. A more complex option. An array of data arrives: several values in one field
{ "values": [ ["nol"], ["odin"], ["dva"], ["tri"] ] }
In this case, the "values" field is an array of values. Therefore, to get a specific value from the array, you need to specify the position of this value in the array.
How to write JSON Path to get each of the fields:
$.values.0.0
—> "nul"$.values.1.0
—> "odin"$.values.2.0
—> «dva»$.values.3.0
—> "tri"
Important! It is necessary to specify the second zero in the JSON Path entry: $.values.*.
0
. Otherwise, the "External Request" will not be able to recognize and write the value to the custom field.
IMPORTANT! You can check the correctness of the JSON Path you wrote in this service . In the upper field, paste the written JSON Path, in the lower left field "Inputs" paste the response body that came to your request. The right field displays the value that will be obtained from the specified response body for the specified JSON Path.
IMPORTANT! More information about writing JSON Path can be found here: link .
Full instructions for the action "External request": link
If you have not found the answer to your question, ask us in the chat inside your account or write to BotHelpSupportBot or to hello@bothelp.io
Get 14 days of full functionality of the platform for creating mailings, autofunnels and chatbots BotHelp.