Hello,
How can I restrict numbers from getting an answers from my linked Chatbot to whatsapp, I need to only provide answers from Chatbot for allowed numbers list, and if the number is not listed they shall get led to get to open account with us to get the access for specific period of time based on subscriptions. can you assist with this please ?
Oleg
May 20, 2025, 7:11am
2
Raian
May 20, 2025, 7:11am
3
If you’re doing very simple filtering , you can use the filter block between nodes , but it’s not the most convenient option.
Recommended approach :
Create an intermediate JavaScript block that checks whether the number (from a variable) is in your ignore list.
The inside looks like this:
If the number is found in the list, it returns false
.
Then just set the condition to check that the result is not equal to false :
This way, only the processes not in the ignore list will continue.
Example JavaScript code:
/** @CustomParams
{
"input_value": {
"title": "Input Value",
"key": "input_value",
"description": "The value to check",
"type": "string"
},
"disallowed_values": {
"title": "Disallowed Values (comma separated)",
"key": "disallowed_values",
"description": "List the values (comma separated) that are not allowed",
"type": "string"
}
}
*/
export default async function run({ data }) {
const input = (data.input_value || '').trim();
const disallowed = (data.disallowed_values || '')
.split(',')
.map(v => v.trim())
.filter(v => v.length > 0);
if (disallowed.includes(input)) {
return { result: false };
}
return { result: true };
}
Let me know if you want to tweak the logic or make it dynamic with variables from earlier nodes.
1 Like
system
Closed
May 24, 2025, 7:12am
4
This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.