• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Webhook or API response field can't be properly used in JavaScript due to < character being misinterpreted as Html tag

I've searched for similar problems but it didn't come up with anything. Here's the thing: I get back an API response with a string – literally it's "This is the <{{|m|2590|}}>".

When using this in Javascript code, it'll just blank it out.

Bildschirmfoto 2023-12-05 um 01.08.12.png

- I've tried leaving out the quotes in the return statement – this fails.
- the issue is resolved if the string is "This is the {{|m|2590|}}", so I'm thinking it's the < and > here.

Further proving the point of the JavaScript module being the problem, here we have what happens if the value is passed as a field straight into another step:
Bildschirmfoto 2023-12-05 um 01.08.45.png

As you can see in the line "Profile Status Text", it renders as "This is the &It;{{|m|2590|}}&gt;".

Does anybody have any input on the internal workings of the Javascript module to resolve this or is it just a bug?
 
P

Pabblymember11

Guest
Hey @AllyDouillette

This particular stage involves programming, necessitating a good command of coding skills. Nevertheless, feel free to explore and try it out on your own. It's essential to understand that we won't be offering technical support for issues related to code errors. We strongly advise going through the Code documentation for further clarification and guidance.

Further, in the "Set Status" action step kindly pass the time in the timestamp format.

1701772287560.png
 
Further, in the "Set Status" action step kindly pass the time in the timestamp format.
I'm kindly pointing you towards the Slack documentation where a non-expiring status is set by passing 0.

Regarding the main issue: The "we won't debug your code" is uncalled for – the code runs through fine if the value doesn't come from a Pabbly field. I've tested it. It's definitely to do with the way the field stores that value / hands it over to JavaScript. Could you tell me how to access the raw body of the response?
 
1701782304600.png
Here's the isolated problem: even if you have straight text, everything between <> gets filtered out by the JavaScript code module, even though this behaviour cannot be replicated when running it otherwise in NodeJS. I can't replace the < and > either, because as soon as it's in the module, there seems to be some value processing that prevents it from being treated as straight text.

JavaScript:
const straightText = "Pabbly <{{|t|10608313|}}> Test mit Tags";
const straightTextWithoutProblematicCharacters = "Pabbly {{|t|10608313|}} Test mit Tags";

console.log("1. Data CurrentTracking Note Text : Pabbly <{{|t|10608313|}}> Test mit Tags");
console.log(straightText)
console.log(straightTextWithoutProblematicCharacters)

return JSON.stringify({
"noteText": "1. Data CurrentTracking Note Text : Pabbly <{{|t|10608313|}}> Test mit Tags",
"straightText": straightText,
"straightTextWithoutProblematicCharacters": straightTextWithoutProblematicCharacters,
});
 
Addition: I'm aware that the fields have to be sanitized for HTML tags before use in code. However, that's not a Html tag. Do I really have to run TWO replace-modules (one for < and one for >) so this clears?
 
P

Pabblymember11

Guest
Please allow us some time, we are currently looking into it.
 
Please allow us some time, we are currently looking into it.
I appreciate it! I understand that the code element is still in beta, but this would be a very essential reason for me to not use Pabbly and return my purchase. :/

The issue really seems to be that it thinks everything that is enclosed by <…> is a HTML tag, even though convention defines it differently – there's no way you could make this a valid Html tag:
"Tag names are used within element start tags and end tags to give the element’s name. Html elements all have names that only use characters in the range 0–9, a–z, and A–Z." (from W3 dot org)

1701985456532.png
 
Last edited:
P

Pabblymember11

Guest
Sorry for the inconvenience but our technical team is constantly looking into your concern and shall notify you with an update soon.
 
For anybody reading – this is caused by overlapping issues. Handing over values in Pabbly fields to use them in code is simply problematic when they contain something that resembles Html tags "<…>". The problem is solely the opening tag.

Replacing with searching for the literal lesser than – "<" – character gives you an error, however, this can be dealt with by using the unicode:

JavaScript:
 const searchStr = new RegExp(`\\u003C`, "g")
 const replaceStr = `HereOnceWasALesserThenSign`
 result = humanReadableNote.replace(searchStr, replaceStr)

As for the whole "everything inside of the presumed tags is omitted" – when it's data from an API call you can just scrub that before handing it over to the return of the module:

JavaScript:
let result = {}
await fetch("https://api.something.com/api/v3/someendpoint", requestOptions)
 .then(response => response.json())
.then(data => result = scrubForForbiddenChars(data))

Using the .json() instead of .text() keeps it an Object whose properties can be accessed and modified by e.g. the scrubForForbiddenChars() function.
 
Last edited:
Top