To gather all the email addresses of customer users in ThingsBoard using the Rule Chain, you can follow these steps:
The script in the 'Script' node can look something like this:
var emailAddresses = [];
var users = msg.payload.users;
for(var i=0; i<users.length; i++){
if(users[i].isCustomer){
emailAddresses.push(users[i].email);
}
}
msg.emailAddresses = emailAddresses;
The 'Function' node can then store the email addresses in a database or send them to an external system using an HTTP request or email integration.
Asked: 2021-09-03 11:00:00 +0000
Seen: 9 times
Last updated: Feb 22 '23