I’m using Logic to post to an external api (triggering directly from the form).
I realised that when i send the values of Textareas with multiple lines the parsing is not happening (replacing the line break with a /n) and my external API is receiving a wrong json raising an error.
if i check the logic History, the json is well formatted (if i copy paste the json that appears in the Logic History the API call works perfectly), so looks like it’s a difference between the History and real-time.
Is anyone experiencing issues with logic and variables with multi-line? any idea?
Attached the configuration in logic, the json from the History and the error in the jsonlint that happens in realtime
Have you been able to test this against an endpoint that can show you exactly what it’s receiving from Logic? You’ll see much more clearly where the problem is.
I use Postbin for this on occaion.
The main problem I’ve found with logic is that the embedded fields are not JSON-encoded, which means if you have e.g. a " in your content, you have invalid JSON. I struggle to imagine that whitespace would invalidate the call, but the server endpoint could certainly be sensitive to that.
One interesting thing is that your Logic image shows the description field wrapped in double-quotes, but in your error message it shows a single quote. Odd.
I’m intercepting the request directly from express
This is what i receive when i execute the request in realtime with logic. This data is collected directly from the buffer that i receive (body section):
{
"customer_id":"8e553f24-1423-4c28-8c73-c4279305c2e1",
"conversation_id":"4",
"intro":"test only one line",
"description":"test line 1
test line 2",
"price":"test line 1
test line 2",
"works":"test line 1
test line 2",
"implementation":"test line 1
test line 2",
"goal":"test line 1
test line 2",
"goodbye":"test only one line"
}
The objects that i have in the Logic History are correctly formatted:
If I apply the object that i have in the Logic History into postman and i execute the api call, i receive it properly.
Data received in the API from the postman call, using the object from the Logic History
{
“gd_customer_id”: “8e553f24-1423-4c28-8c73-c4279305c2e1”,
“gd_conversation_id”: “4”,
“intro”: “test only one line”,
“description”: “test line 1\ntest line 2”,
“price”: “test line 1\ntest line 2”,
“how_works”: “test line 1\ntest line 2”,
“implementation”: “test line 1\ntest line 2”,
“goal”: “test line 1\ntest line 2”,
“goodbye”: “test only one line”
}
My best guess is that Logic is sending linefeeds or crlf’s, rather than encoding them as \n, and that express’s JSON parser isn’t handling that well.
Obv you can’t change Logic, but maybe you can “repair” the JSON server-side before processing.
I’d try to reproduce the failure with Postman against your API, with raw CRLF’s, and see if you can get the same error. If not, the 400 is happening internally to Logic, and it will be very difficult to identify the cause.
Good to know. Webflow has made changes lately and re-directed its dev staff away from Logic and Memberships towards other systems.
I think that affects support on these subsystems as well.
The people on those teams were fantastic, but if they’ve been reassigned, that may be all you need to know to make your platform decision for your automation piece.