I’ve just started experimenting with google chat apps using app script. I followed the instructions on this link:
Build a Google Chat app with Google Apps Script
I followed this link to publish the app:
Publish Google Chat apps
My App script has this code from the original template:
function onMessage(event)
{
var name = “”;
if (event.space.type == “DM”) {
name = “You”;
} else {
name = event.user.displayName;
}
var message = name + ” said “” + event.message.text + “””;
return { “text”: message };
}
function onAddToSpace(event)
{
var message = “”;
if (event.space.singleUserBotDm) {
message = “Thank you for adding me to a DM, ” + event.user.displayName + “!”;
} else {
message = “Thank you for adding me to ” +
(event.space.displayName ? event.space.displayName : “this chat”);
}
if (event.message) {
// Bot added through @mention.
message = message + ” and you said: “” + event.message.text + “””;
}
return { “text”: message };
}
function onRemoveFromSpace(event)
{
console.info(“Bot removed from “,
(event.space.name ? event.space.name : “this chat”));
}`
`
When i add this app to my own is, i’m able to send a message and get a response, it also works for a colleague of mine who is an organization admin. However for other members of the workspace, they are able to find the app and add it. But when they try to send a message on DM, it gives a message ” not responding”
Not sure what needs to be done. Looks like some sort of issue with access policy, but being new to GCP, i am not sure where to find it.
When the user sends a hello message to the app, it should have sent back a You said "hello"
Kiran Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.