I have a chatbot I am trying to make for Google Chat platform. My boss wants it so that if someone says in a room "Im Bored" or "its slow" and so on that it responds with a canned response. Something like "have you made your calls today?" or similar. I have attempted to do this but can only get it to work if the chat bot is mentioned.
function onMessage(event) {
var name = "";
if (event.message.text == "Im Bored") {
name = "You";
} else {
name = event.user.displayName;
}
var message = name + ": You could scrub accounts or make some calls. Have you logged into statflo today? ";
return { "text": message };
}
what we would like is it to see the messages and find any that say bored or slow and respond automatically. The above does not work for our use. Any ideas on this?
I have read the event formats page at https://developers.google.com/hangouts/chat/reference/message-formats/events but couldnt get anywhere with that.