I have an Excel spreadsheet for an on-call rotation. With the help of this answer, I was able to use Power Automate to trigger an automated Microsoft Teams message containing the names of people on schedule. Right now, Power Automate is just extracting the names from spreadsheet and adding it to the Teams message. I would like to be able to tag the team members in the message so they get notified.
Spreadsheet should be easily maintainable so I want to avoid using any type of programmatic data(i.e: account ID) that Teams may use for it's users.
Like already mentioned (pun intended) by Prasad-MSFT you can use an at-mention token. In your setup I would put the team members in an array (per team) and loop through those arrays to collect the tokens. After that you can join the arrays with tokens with a comma character.
Below is an example.
Let's assume we have an Excel like below. As you can see the team members are separated by a semi colon character.
Add two initialize variables actions of type Array for both Teams to collect the mention tokens
Add an Apply to Each for every team. Use the expression below for the select an output field.
split(first(outputs('List_rows_present_in_a_table')?['body/value'])?['Team 1'], ';')
Within the Apply to each action add a Get an @mention token for a user action. Use the item()
Add an Append to Array variable. Append the token to the MentionTokenTeam1Array
Repeat step 3 & 4 for your second Team. Make sure you store the tokens of this team in the MentionTokenTeam2Array variable.
Within your Post message in chat or channel use the following expression:
Concat('On call for week of ', utcNow('M/d'), ': ', join(variables('MentionTokenTeam1Array'), ', '), ' and ', join(variables('MentionTokenTeam2Array'), ', '))