How to @mention a user in Google Chat Chat App

Have I missed some documentation or am I right in thinking there is no way to @mention someone in an AppSheet Google Chat App?

We want to be able to send someone a direct message when a task is assigned to them but, from what I can see and have experimented with, the only way to do this would be to make individual Botd for each user pre-filtered for that use to send them a DM, whereas it would be handy to @mention them in a Space instead, therefore only needing one Bot.

Any suggestions appreciated.

Solved Solved
1 7 5,331
1 ACCEPTED SOLUTION

I found a solution so I thought I'd answer my own question to benefit others and as a reminder to me.

To @mention someone in a Google Chat via an AppSheet Chat App you need to use the USER_ID as specified in the Google Chat API Documentation: Messages that @mention specific users.

As an example if you have a field called "Google User ID" then the message text you should add to the Bot would follow this format

<users/<<[Google User ID]>>>

I was dubious it would work as I thought the parsing would get confused by the closing >>> but it does work as you can see in this screenshot:

Screenshot 2023-05-05 13.01.40.png

I hope others find this useful.

 

View solution in original post

7 REPLIES 7

I found a solution so I thought I'd answer my own question to benefit others and as a reminder to me.

To @mention someone in a Google Chat via an AppSheet Chat App you need to use the USER_ID as specified in the Google Chat API Documentation: Messages that @mention specific users.

As an example if you have a field called "Google User ID" then the message text you should add to the Bot would follow this format

<users/<<[Google User ID]>>>

I was dubious it would work as I thought the parsing would get confused by the closing >>> but it does work as you can see in this screenshot:

Screenshot 2023-05-05 13.01.40.png

I hope others find this useful.

 

Hi Stephen,

I tried to use your method but it didn't work.

This is what I am getting:
"
<users/user1@org.com>
"

@Madhav_More if you look at my previous post (and refer to the documentation) the format is

<users/<<[Google User ID]>>>

that's [Google User ID] not the email address.  You need to get the ID (it's a number) from the People API, etc.

Thanks Man, It works!!

Just to add it over here on how to get that User ID.
Go to https://developers.google.com/people/api/rest/v1/people/searchDirectoryPeople

On right hand side under "Query" type in email id of person in your org & "Readmask" as "names" . Execute and you now have Google User ID of that email.

Thank you for the useful tip @StephenHind ! 

Were you able to apply the mention to the text inside the card as well? 

Also were you able to mention multiple users in a single message?

The card is a detail view from AppSheet, so you cannot do any kind of @mentinoning in there.

Yes you can mention multiple users as I've developed a bot to do that also.

Thanks for the reply @StephenHind  ๐Ÿ™‚ 

Top Labels in this Space