Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setup mentions in MSTeams #16

Closed
Nestor231 opened this issue Jan 13, 2022 · 21 comments
Closed

How to setup mentions in MSTeams #16

Nestor231 opened this issue Jan 13, 2022 · 21 comments

Comments

@Nestor231
Copy link

Nestor231 commented Jan 13, 2022

Hi @onozaty !

Good day!

I have a question, I'm trying to use this plugin in conjunction with MS Teams,

but I don't know what should I supply on the Assign Notice ID and how do i retrieve that id,

I am trying to get the mentions working on MSTeams, How do I do it?

Thanks!

@onozaty
Copy link
Owner

onozaty commented Jan 13, 2022

Hi @Nestor231

In Teams, Incoming Webhooks do not allow for Mentions.
Therefore, it is not possible to use this plugin for mentioning either.

When Teams supports it, we will consider supporting it in this plugin as well.

Thanks.

@Nestor231
Copy link
Author

Nestor231 commented Jan 14, 2022

Hello @onozaty

I appreciate your fast feedback :)

Actually mentions is already supported in their MSTeams incoming webhook

Please check this link for reference

Using AdaptiveCards For Teams Mention When sending message

i tested this as well using json and submitted a request to an incoming webhook that i set up with a channel.

Here's the sample json request body i used for the request:

{
	"type": "message",
	"attachments": [{
		"contentType": "application/vnd.microsoft.card.adaptive",
		"content": {
			"type": "AdaptiveCard",
			"body": [{
					"type": "TextBlock",
					"size": "Medium",
					"weight": "Bolder",
					"text": "Sample Adaptive Card with User Mention"
				},
				{
					"type": "TextBlock",
					"text": "[Project Name] Hi, <at>Sample_Name</at>. A redmine ticket has been assigned to you."
				}
			],
			"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
			"version": "1.0",
			"msteams": {
                                "width": "Full",
				"entities": [{
					"type": "mention",
					"text": "<at>Sample_Name</at>",
					"mentioned": {
						"id": "<email_registered_on_teams >", // For confidentiality purposes
						"name": "<name_registered_on_teams>"
					}
				}]
			}
		}
	}]
}

From what I learned by playing around with the request body:

  • in teams, id can be the mentioned user's email address on teams. ( Assign Notice ID can be set as the user's teams email address for this matter)
  • "name" under "mentioned" on the "msteams" field is the display name that will be displayed (FirstName LastName combination from redmine can be displayed as the value)

And here's the result:
InkedoVmpauhTzI_LI

@onozaty
Copy link
Owner

onozaty commented Jan 14, 2022

Hi @Nestor231

Thank you for the information.

I found out that it is supported by Adaptive Cards in Teams.

I would like to consider implementing it.
I think the information you provided will be very helpful in implementation.

Thank you very much.

@Nestor231
Copy link
Author

You're welcome @onozaty,

Have a great day!

@onozaty
Copy link
Owner

onozaty commented Jan 18, 2022

Hi @Nestor231

I'm trying out a small message to see if I can make a mention.

{
  "type": "message",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.adaptive",
      "content": {
        "type": "AdaptiveCard",
        "body": [
          {
            "type": "TextBlock",
            "text": "Hi <at>UserA</at>"
          }
        ],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.0",
        "msteams": {
          "entities": [
            {
              "type": "mention",
              "text": "<at>UserA</at>",
              "mentioned": {
                "id": "user@example.com",
                "name": "HogeHoge"
              }
            }
          ]
        }
      }
    }]
}

I thought that if I changed the email address in the id to the email address used when logging in to Teams as appropriate, I would be able to make a Mention, but it hasn't worked.

image

The color of the username part changes, but it does not become a link.
Also, no mentions are made.

If you can find anything strange, I would appreciate your advice.
I am using Teams Free (classic) to verify.

Thanks.

@Nestor231
Copy link
Author

Nestor231 commented Jan 19, 2022

Hello @onozaty ,

N6k7whzRLE

image

I tested your request body, and it's working fine on my end.
I'm not sure if it's because you're using Teams Free.

I tested this using Microsoft Teams Version 1.4.00.32771 (64-bit). It was last updated on 12/13/2021.

@Nestor231
Copy link
Author

Nestor231 commented Jan 19, 2022

I was able to replicate what you did just now.

In my case, i used an email which is not registered within teams.

I am not sure with Teams Free with that behavior.

What I can infer is that, Teams couldn't find the said email that you used for the mention
or that there's a limitation on Teams Free. I'm not sure which is the case though

@onozaty
Copy link
Owner

onozaty commented Jan 19, 2022

Thank you for trying it.

The email address "user@example.com" will be replaced with the email address used to log in to Teams.
It may be a limitation in Teams Free.

@onozaty
Copy link
Owner

onozaty commented Jan 29, 2022

Hi @Nestor231

I have implemented it.
Could you please give it a try?

It is still in branch status.
Please checkout "feature/17-teams-adaptive-cards" and give it a try.

git fetch
git checkout feature/17-teams-adaptive-cards

Thanks.

@Nestor231
Copy link
Author

Nestor231 commented Jan 31, 2022

Hello @onozaty ,

Sorry I replied so late,

I have tested it now and,

Yep, It's working! Thanks man ! much appreciated

InkedDw0fI1oJAK_LI

InkedBb7xzar2Ey_LI

@onozaty
Copy link
Owner

onozaty commented Jan 31, 2022

Thanks for the confirmation!
Thanks to your support, I was able to implement it.

It will be officially released as version 2.1.0 later.

@onozaty
Copy link
Owner

onozaty commented Feb 1, 2022

It has been officially released as v2.1.0.

Thanks!

@Nestor231
Copy link
Author

You're welcome man and thanks!
Looking forward to more of your projects in the future ^_^

@Jiemin17
Copy link

Jiemin17 commented Dec 2, 2022

Hi @onozaty
I have the same problem
and I would like to ask how did you solve it in the end

@onozaty
Copy link
Owner

onozaty commented Dec 2, 2022

@Jiemin17
Copy link

Jiemin17 commented Dec 5, 2022

Hi @onozaty
Thanks for your reply.
My problem is that I can't tag anyone either
My code :

{
    "type": "message",
    "attachments": [
        {
        "contentType": "application/vnd.microsoft.card.adaptive",
        "content": {
            "type": "AdaptiveCard",
            "body": [
                {
                    "type": "TextBlock",
                    "size": "Medium",
                    "weight": "Bolder",
                    "text": "Sample Adaptive Card with User Mention"
                },
                {
                    "type": "TextBlock",
                    "text": "try to at <at>me</at> and <at>karenlian</at>"
                }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.0",
            "msteams": {
                "entities": [
                    {
                        "type": "mention",
                        "text": "<at>me</at>",
                        "mentioned": {
                          "id": "jie@xxx.biz",
                          "name": "me"
                        }
                      },
                      {
                        "type": "mention",
                        "text": "<at>karenlian</at>",
                        "mentioned": {
                          "id": "karenlian@xxx.biz",
                          "name": "karenlian"
                        }
                      }
                ]
            }
        }
    }]
}

02
In the picture, although the text has turned blue, the members have not been tagged successfully

@onozaty
Copy link
Owner

onozaty commented Dec 5, 2022

Hi @Jiemin17

I see that the question is not about this plugin.

The format seems to be correct.
If the UPN was wrong, this could happen.
The part specified in mentioned/id.

This is usually the email address used to log in to Teams, but depending on how AD is operated, the UPN may not match the email address.

Thanks.

@nicoardizzoli
Copy link

nicoardizzoli commented May 3, 2023

Hello there, Someone knows how can i mention @general (and not users). I really need this functionality

@onozaty
Copy link
Owner

onozaty commented May 3, 2023

Hello there, Someone knows how can i mention general (and not users). I really need this functionality

Adaptive cards in Teams does not yet seem to support mentions to channels or teams.

Thanks.

@nicoardizzoli
Copy link

Thanks @onozaty and do you know how can i make it ? i need to send a notificacion from a backend application (springboot) via webhook to a teams channel, and i need to mark this message as IMPORTANT or mention General to make teams throws a notificacion to the users in this channel

@onozaty
Copy link
Owner

onozaty commented May 4, 2023

Webhook does not support this, so it will be necessary to use other methods.
For example, the Graph API appears to allow mentions to be made to channels.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants