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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-09-03 11:00:00 +0000
Seen: 9 times
Last updated: Feb 22 '23