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

rooms.media API endpoint only upload file but does not send message #34956

Open
mkandel-lockself opened this issue Jan 17, 2025 · 13 comments
Open
Labels

Comments

@mkandel-lockself
Copy link

Description:

The rooms.media API endpoint does not send a message, but only uploads the file to the channel. Unlike rooms.upload, which does send a message but will be obsolete in version 8.0.0.

Steps to reproduce:

  1. Call rooms.media endpoint with a bot
curl -s --request POST \
    --url "https://<server>/api/v1/rooms.media/<rid>" \
    --header "X-User-Id: <X-User-Id>" \
    --header "X-Auth-Token: <X-Auth-Token>" \
    -F "file=@<filename>;type=text/plain" \
    -F "msg=foo"
  1. Open the channel page. You'll see the file in ... > Files but not the message in the feed.

Expected behavior:

A message sended with a notification like rooms.upload endpoint.

Actual behavior:

The file is uploaded but no message are sent.

Server Setup Information:

  • Version of Rocket.Chat Server: 7.0.0
  • Number of Users: 100
  • Deployment Method: Docker
  • NodeJS Version: 20.18.1
  • MongoDB Version: 7.0.15

Client Setup Information

  • Desktop App or Browser Version: 4.1.2 (desktop)
  • Operating System: MacOS

Additional context

I noticed in the code that for the rooms.media route there is no message sending, unlike the rooms.upload route.

@reetp
Copy link

reetp commented Jan 17, 2025

This isn't a really a bug but a feature request.

I'll try and ask for a comment why this has changed.

Don't expect a fast response.

@casalsgh
Copy link
Contributor

Asked internal engineers to take a look

@Per0x1de-1337
Copy link

Hey, I am currently working on this issue and want to clarify if
Do you want to enhance the current API ( rooms.media ) to perform two actions in a single API call - uploading a file to a channel and sending a message about that file upload in the same request? This would streamline the process and reduce the number of API calls needed for file sharing.

@mkandel-lockself
Copy link
Author

Hey, I am currently working on this issue and want to clarify if Do you want to enhance the current API ( rooms.media ) to perform two actions in a single API call - uploading a file to a channel and sending a message about that file upload in the same request? This would streamline the process and reduce the number of API calls needed for file sharing.

Hello, yes this is exactly what I want to do, just like the current API (rooms.upload) with the msg parameter.

@reetp
Copy link

reetp commented Jan 23, 2025

Hey, I am currently working on this issue

You should never start working on any issue until you have asked on open #support

Read all this please:

https://gist.github.com/reetp/b0ba4e3d0ea2ff48ca9da00a5a647d42#github

Note that Casals has referred this to the internal teams:

Asked internal engineers to take a look

You need to wait for the outcome of that first. This may be something they want fixed, it may be something they do themselves, or it maybe something they removed on purpose and do not intend fixing.

You'll just have to wait.

@Per0x1de-1337
Copy link

Hello, yes this is exactly what I want to do, just like the current API (rooms.upload) with the msg parameter.

I have implemented this locally.

Just let me know the what is the response of the internal engineers

@casalsgh
Copy link
Contributor

I asked team to check here. It's on their agenda to get back

@ricardogarim
Copy link
Contributor

hey @mkandel-lockself! thanks for reaching out!

after investigating, i can confirm that the POST /rooms.media endpoint is working as expected. this endpoint is solely for the media upload process.

if you need to trigger a notification about the media being uploaded to a channel, you'll need to call the POST /rooms.mediaConfirm endpoint and pass the rid along with the upload id provided by the previous endpoint call.

from the perspective of allowing you guys to make a pull request suggesting a change to this behavior, although i think it’s a great idea, we won’t be able to accept it into the product soon. this is due to potential conflicts and breaking changes within our existing ecosystem. moves like this often require some product roadmap planning to phase out an existing behavior in order to introduce a new one.

let me know if you have any other questions!

@Per0x1de-1337
Copy link

Thank you for your clarification.

@Per0x1de-1337
Copy link

@ricardogarim I have checked some of the issues but it seems that many of the potential issues are meant to be fixed by internal team. Can you please ping me in the issues where we ( contributers ) can add our contribution.

@reetp
Copy link

reetp commented Jan 27, 2025

@ricardogarim I have checked some of the issues but it seems that many of the potential issues are meant to be fixed by internal team. Can you please ping me in the issues where we ( contributers ) can add our contribution.

Don't @ people - it gets annoying and you get blocked or muted.

Please read this about issues. No one is going to sit and walk you thorough this. Please look on https://open.rocket.chat in teh gsoc2025 team.

Developers readme

@mkandel-lockself
Copy link
Author

hey @mkandel-lockself! thanks for reaching out!

after investigating, i can confirm that the POST /rooms.media endpoint is working as expected. this endpoint is solely for the media upload process.

if you need to trigger a notification about the media being uploaded to a channel, you'll need to call the POST /rooms.mediaConfirm endpoint and pass the rid along with the upload id provided by the previous endpoint call.

from the perspective of allowing you guys to make a pull request suggesting a change to this behavior, although i think it’s a great idea, we won’t be able to accept it into the product soon. this is due to potential conflicts and breaking changes within our existing ecosystem. moves like this often require some product roadmap planning to phase out an existing behavior in order to introduce a new one.

let me know if you have any other questions!

I understand, the functionality that allows users to send a message with a file (e.g. rooms.upload) will be removed (🥲). I don't see the rooms.mediaConfirm endpoint on https://developer.rocket.chat/apidocs/. Is it already usable?

@reetp
Copy link

reetp commented Feb 1, 2025

I understand, the functionality that allows users to send a message with a file (e.g. rooms.upload) will be removed (🥲). I don't see the rooms.mediaConfirm endpoint on https://developer.rocket.chat/apidocs/. Is it already usable?

Can't see it there - you might want to have a search in the code in case it is there but not yet documented.

Hopefully one of the team will let you know soonest.

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

No branches or pull requests

5 participants