Mention a User in Microsoft Teams Channel Message - Not Working

Hello,
there was already an issue how to solve this. mention-a-user-in-microsoft-teams-channel-message

I tried to solve it this way, but I always receive this error. Any Idea?

The operation failed with an error. [400] Provided payload is invalid. Errors - Key - ‘’ , Error - ‘The given untyped value ‘[{“id”:0,“mentionText”:“Ein Test”,“mentioned”:{“user”:{“displayName”:“Theo”,“id”:“XXXXXXXXXXXXXXXXXXXXXXXXxx”}}}]’ in payload is invalid. Consider using a OData type annotation explicitly.’

Hi,

Looks like your JSON is invalid- you are using smart quotes instead of straight ones.

Try this one:

[
    {
        "id": 0,
        "mentionText": "Ein Test",
        "mentioned": {
            "user": {
                "displayName": "Theo",
                "id": "XXXXXXXXXXXXXXXXXXXXXXXXxx"
            }
        }
    }
]

According to the screenshot provided, the user is not using smart quotes.

The quotes were converted to smart quotes by the forum software because it wasn’t formatted as code

samliewrequest private consultation

Join the unofficial Make Discord server to chat with us!

My bad, sorry.
Smart quotes were my first idea after validating the JSON provided in the comment.

According to Microsoft documentation, everything is made correctly at the level of:

  1. Chat message
  2. Chat message mention
  3. Mentioned identity set

So the only idea I have is the formatting of the end JSON brackets. @samliew, in one of your replies you found that the error was caused by whitespace- potentially it could be the same case here.

For debugging process I personally would delete <div>'s also, to have as clean request as possible.

@Wilhelm_Markett, please export your bundle and copy-paste it into a JSON validator (you can find plenty of them online, like https://jsonlint.com).

1 Like

Thanks for your replies.
I did both, remove the div tags und checked the input bundle → JSON is valid