Closed JavaCS3 closed 6 years ago
I did change the part of code that was testing limit_to_domain in order to log a warning in CiscoSparkbot.js and now its seems running OK.
if (controller.config.limit_to_domain) {
var domains = [];
if (typeof(controller.config.limit_to_domain) == 'string') {
domains = [controller.config.limit_to_domain];
} else {
domains = controller.config.limit_to_domain;
}
var allowed = false;
var userEmail = message.data.personEmail;
for (var d = 0; d < domains.length; d++) {
if (userEmail.includes(domains[d]) || userEmail.includes('@sparkbot.io')) {
allowed = true;
}
}
if (!allowed) {
console.log('*** WARNING *** : this message came from ' + userEmail + ' a domain that is outside of the allowed list', controller.config.limit_to_domain);
// this message came from a domain that is outside of the allowed list.
return false;
}
}```
Botkit version: 0.6 OS: MacOS (It's not related to OS)
When bot received any message from cisco spark. It will get
I have found the root cause. It looks like Cisco Spark API have changed. Cisco Spark sent
There's no "user" field in the message. In this code It will acquire "user" field. So it raised an exception.