I am having an odd issue after updating to 0.222.1 last night. I get a JSON payload from the webhook that sometimes will have a key called “remove” with the value set to “yes”. The value is always yes if the remove key is in the JSON.
I then set a variable in my code node that checks to see if that property exists in the Webhook payload, like this:
let remove = $node["Webhook"].json["body"]["0"].hasOwnProperty("remove");
I then use a switch to set a variable named “state”, like this:
case (callerCallInfo != "active" && calleeCallInfo != "active" && remove == true):
state = "ended";
duration = 0;
break;
My problem is that no matter if the “remove” key is in the payload or not, my remove variable always returns as true. I noticed this is happening on other variables using hasOwnProperty. This had previously been working so it could be something I missed in the changelog
EDIT
I adjusted my switch statement to include the following but it still returns true
default:
remove = false;
EDIT 2
I’m able to get the correct boolean value if I use a Set node directly after the Webhook node like this: