Hi, I have scenario where I get telephone number information from the voiceflow chatbot to webhook, then it is sent to Google Sheets Add a Row module and then to Text Parser to convert it to text, then it goes to Set Variable module where I want to edit this number into format accepted by Twilio (+421908123456).
The customers might leave the telephone number in different formats (00421 0908 123 456, 0908 123 456, 908 123 456 etc), so I first created regex [\s-()] in Text parser to remove spaces etc, and then I set the function in the Set Variable module to create the format accepted by Twilio:
{{if(contains(toString(4.text); βββ+421"ββ) & length(toString(4.text)) = 13; toString(4.text); if(contains(toString(1.phone); ββ00421ββ) & length(toString(1.phone)) = 14; βββ+421"" & " + slice(toString(1.phone); 5); if(contains(toString(1.phone); ββ0ββ) & length(toString(1.phone)) = 10; βββ+421"β & " + slice(toString(1.phone); 1); if(length(toString(4.text)) = 9; βββ+421"β & " + toString(4.text); βββNo matching patternβββ))))}}
However, it does not work. It works only if I get the number from the Text parser in the format 908123456, but all the other variants are not matched by the condition in the function and βNo matching patternβ is placed into the variable instead of the formated number +421908123456. It seems that the zeros at the beginning of the number cause the problem, and even though the number is converted into text in the Text parser, and even though it is mapped via toString in Set Variable module, it still does not help. Can you help me set this right and explain what is wrong here?