2

I have a chatbot and I am trying to make the bot mention a user in a space. For example, we have:

@googlechatBot Hello

User said "@googlechatBot Hello"

But I would like you to mention the user in the answer. Something like that

@googlechatBot Hello

@User said "@googlechatBot Hello"

The code I use is from the template found in the documentation.

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 };
}
Gamaor
  • 85
  • 3

1 Answers1

1

Did you tried this approach?

{
    "text": "Hey <users/123456789012345678901>! Thank you for using _Pizza bot!_"
}

As described here https://developers.google.com/chat/api/guides/message-formats/basic?hl=en#messages_that_mention_specific_users