-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add initial support for user mentions #197
Comments
For this JSON block: {
"type": "message",
"text": "Hey <at>Some User</at> check out this message",
"entities": [
{
"type":"mention",
"mentioned":{
"id":"[email protected]",
"name":"Some User"
},
"text": "<at>Some User</at>"
}
]
} Is the e.g.,
|
When attempting to find the minimum required syntax, I found that failing to provide the
The HTTP respone code still appears to be 200 however. For a successful submission (and mention of target user), a body response of |
Some potentially relevant official documentation:
Example of an ID:
Example of a User Principal Name (UPN): |
Accepting (for now) that this is the minimal JSON payload required to produce a message that mentions a user: {
"type": "message",
"text": "Hey <at>Some User</at> check out this message",
"entities": [
{
"type":"mention",
"mentioned":{
"id":"[email protected]",
"name":"Some User"
},
"text": "<at>Some User</at>"
}
]
} I can see how we would populate all values easily enough except for this one: "text": "Hey <at>Some User</at> check out this message", If we accept a raw value directly from the user, do we parse the text and require that ...
If the latter, we can search/replace against that placeholder and drop in the username (shown as If the former, we leave the text as-is. Perhaps the behavior can be configurable:
|
|
Note to self: Look back at https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/channel-and-group-conversations?tabs=typescript#work-with-mentions later for inspiration regarding handling the |
The go-teams-notify project currently implements much of the The JSON payload appears to follow the |
https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/channel-and-group-conversations?tabs=json#retrieve-mentions provides example JSON in that format (trimmed): {
"type": "message",
"text": "Hey <at>Pranav Smith</at> check out this message",
"entities": [
{
"type":"mention",
"mentioned":{
"id":"29:08q2j2o3jc09au90eucae",
"name":"Pranav Smith"
},
"text": "<at>@Pranav Smith</at>"
}
],
} This doesn't appear to be in either of
Perhaps validation is lax and Teams isn't rejecting JSON payloads that don't completely meet the |
Per further discussion on atc0005/go-teams-notify#127 and additional reading, perhaps the sample JSON payload is a third format. I'll refer to it for now using the suggested name of "bot api". I'm going to prototype changes to the Worst case, I can replicate all required functionality for the time being as internal/unexported functionality which can be refactored later. This may be the least complicated route to take for now. More to come. |
See also atc0005/go-teams-notify#149. The prototyping work is surfacing enough limitations that I'm strongly leaning towards exposing the |
This is the direction I went. Because the "botapi" package will be an incomplete representation of the actual bot api and because it doesn't support all of the features of the
Granted, this is probably not a big deal; I am unsure which approach is better:
I'd ordinarily think of the first approach in order to be backwards compatible, but using the user mention support would be an intentional choice and a good time for the app to surface incompatibilities between the settings. All of that said, once |
I'm actually leaning towards emitting errors for incompatible settings. Users will opt into using user mention support and it would be good to explicitly note what options do not work well together. |
I think I've got the initial prototype where it needs to be for a test/dev release. Still rough edges and no doc updates yet to reflect the changes. I also have some more cleanup work to do for the bundled local changes |
Latest changes have been pushed upstream and local prototype updated to use them. Aiming for an alpha release of both the prototype of this CLI app and the |
Library update available here: https://github.com/atc0005/go-teams-notify/releases/tag/v2.7.0-alpha.1 |
Initial support for user mentions is provided by way of new alpha release of `atc0005/go-teams-notify` library. Due to limitations of the library, user mentions are not compatible with specific existing features: - message title - URL "buttons" - message border coloring Future support for user mentions is expected to provide most (or perhaps all) of this functionality. README has been updated to provide an example of the new user mention functionality. refs GH-197
I've not yet tested to determine if it works in our environment, but as noted on atc0005/go-teams-notify#127, the following curl/JSON recipe can be used to target a specific user when posting to a Teams channel via webhook URL:
Need to start prototyping changes to this tool and the library to support that functionality.
The text was updated successfully, but these errors were encountered: