New R package MatterMostR and question about priority

Hello Mattermost Community!

I’m excited to share that I’ve just released an R package called MattermostR!

These functions allow R users to interact with Mattermost for messaging, file uploads, channel management, and more, directly from their R environment.

Here are some of the key functions available in the MattermostR package:

  • authenticate_mattermost: Authenticate with the Mattermost server using either a token or username/password.
  • send_mattermost_message: Send a text message to a specified Mattermost channel, optionally with one or multiple file attachment(s).
  • get_all_teams / get_team_channels: Retrieve information about teams and their channels.
  • get_channel_posts: Retrieve posts from a specific channel.
  • delete_post / delete_channel: Delete a post or a channel programmatically. (archives channel only)
  • create_channel: Create a new Mattermost channel.

One question I have is about the priority setting for messages. Currently, I’m using Mattermost server version 9.11.1. When I include the priority metadata in the API call, the message posts successfully, but there is no visible indication of priority in the Mattermost UI. However, when I omit the priority, the message posts successfully but without any visible indication of priority in the Mattermost UI. The server response indicates that the priority metadata is being processed, but I do not see any visual representation of the priority in the Mattermost channel. Does anyone know if there are specific settings or configurations that need to be enabled on the server or client to support priority visibility, or is this a known limitation for version 9.11.1?

For reference, here is the request body and response I received:

Request Body: { “channel_id”: “<channel_id>”, “message”: “”, “props”: { “priority”: { “priority”: “High”, “requested_ack”: true } } }

Response Status: 201 Created

Full Log: Request Body: { “channel_id”: “um13yw8k73r8ucqo6f1w8wpukw”, “message”: “Hello, Mattermost! This is a test message at 2024-10-04 12:22:12.740591”, “props”: { “priority”: { “priority”: “High”, “requested_ack”: true } } } → POST /api/v4/posts HTTP/1.1 → Host: [REDACTED] → User-Agent: httr2/1.0.3 r-curl/5.2.2 libcurl/8.3.0 → Accept-Encoding: deflate, gzip → Authorization: [REDACTED] → Accept: application/json → Content-Type: application/json → Content-Length: 189

← HTTP/1.1 201 Created ← Server: nginx ← Date: Fri, 04 Oct 2024 10:22:23 GMT ← Content-Type: application/json ← Content-Length: 517 ← Connection: keep-alive ← Permissions-Policy: ← Referrer-Policy: no-referrer ← Vary: Accept-Encoding ← X-Content-Type-Options: nosniff ← X-Request-Id: exz3e813ujghjfshqueao9145a ← X-Version-Id: 9.11.1.10419911144.929d11ada0d967ec542a54166057bf42.false ← X-Frame-Options: SAMEORIGIN ← X-XSS-Protection: 1; mode=block

Response Headers: <httr2_headers> Server: nginx Date: Fri, 04 Oct 2024 10:22:23 GMT Content-Type: application/json Content-Length: 517 Connection: keep-alive Permissions-Policy: Referrer-Policy: no-referrer Vary: Accept-Encoding X-Content-Type-Options: nosniff X-Request-Id: exz3e813ujghjfshqueao9145a X-Version-Id: 9.11.1.10419911144.929d11ada0d967ec542a54166057bf42.false X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block

Response Body: $id [1] “i4nauadw57rque4mmeucsasxjc”

$create_at [1] 1.728037e+12

$update_at [1] 1.728037e+12

$edit_at [1] 0

$delete_at [1] 0

$is_pinned [1] FALSE

$user_id [1] “h74wwx35dbnttpsetxk4wkb8sr”

$channel_id [1] “um13yw8k73r8ucqo6f1w8wpukw”

$root_id [1] “”

$original_id [1] “”

$message [1] “Hello, Mattermost! This is a test message at 2024-10-04 12:22:12.740591”

$type [1] “”

$props $props$priority $props$priority$priority [1] “High”

$props$priority$requested_ack [1] TRUE

$hashtags [1] “”

$pending_post_id [1] “”

$remote_id [1] “”

$reply_count [1] 0

$last_reply_at [1] 0

$participants NULL

$metadata named list()

No visible indication of priority in the UI.

Also, I’d love to get your thoughts on additional features you’d like to see in this package. Are there any specific functionalities or integrations with R that you think would be useful?

Thanks for your time, and I’m looking forward to your feedback and suggestions!

Cheers, Laurens

1 Like

Hi Laurens! Thanks for sharing your MattermostR package with the community—this is a fantastic addition for R users! Regarding your question on priority settings, it seems that the Mattermost UI does not currently support visual indicators for message priority metadata. You can find more details on message properties in the Mattermost API documentation which might help clarify server-side limitations. Let us know if you have any other questions or need further support! :blush:

Hi John,

thanks for your comment and for the compliment. Feel free to star the repo on Github.
Further I wanted to ask if the company is ok that I made the r package and that I in the future might upload it to cran repository (comparable with pypi for python)

I studied of course extensively the mattermost api documentation which was really helpful in programming the r package.

Regarding the priority and acknowledgment I see from the response body that I get back from the mattermost REST api that the parameters have been received correctly.

from my start post:

$props $props$priority $props$priority$priority [1] “High”

$props$priority$requested_ack [1] TRUE
__

(I used High but also urgent and a couple of other variations)

But even though accepted by the rest api it does never show in the ui. In the UI I can use the button to write an urgent label by hand.

So I guess that something is not being passed through from the api to the UI. So please let me know if my understanding is correct that even though I send the correct message and priority to the server there will never be a response in the UI. If this is the case it might be worthwhile to mention this in the mattermost api documentation for other developers.

See documentation screenshot below:

kind regards,

Laurens

1 Like

Hi Laurens,

Thank you for the thoughtful follow-up and for your ongoing contributions with the MattermostR package! It’s fantastic to see your initiative, and yes, you’re welcome to upload the package to CRAN as long as it adheres to their guidelines and doesn’t conflict with Mattermost’s licensing (you can check Mattermost’s licensing details here).

Regarding your question about the priority metadata, you’re absolutely correct that while the Mattermost REST API successfully processes the priority fields, the current UI does not have a built-in visual representation for priority labels set via the API. This is why you’re seeing the parameters accepted but no corresponding UI indication. It would indeed be helpful to clarify this in the documentation, and I’ll pass along your feedback to the relevant team.

Let me know if you have any other questions, and thanks again for your valuable work! :blush: