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

Ephemeral messages with inputs don't disappear #1629

Closed
fmPeretti opened this issue Jan 8, 2025 · 3 comments
Closed

Ephemeral messages with inputs don't disappear #1629

fmPeretti opened this issue Jan 8, 2025 · 3 comments
Labels
question M-T: User needs support to use the project Version: 3x web-client

Comments

@fmPeretti
Copy link

fmPeretti commented Jan 8, 2025

When sending a form like message with inputs as ephemeral, It doesnt dissapear in between sessions as the other messages.
It just deletes the content of the inputs.

Notice that it is an ephemeral message given that it is tag as Only for you, and is not visible by anyone else

Reproducible in:

python 3.10.6
Slack APP

Steps to reproduce:

  1. Create a block with some inputs
  2. Send the block as an ephemeral message to a channel
  3. Fill up the form
  4. Force reload

Expected result:

The Message with the form will dissapear

Actual result:

The form message is still there, and it has only deleted the content of the inputs.

Picture Example

This is a day old message after I shutdown my computer and Force reload slack
image

@fmPeretti fmPeretti changed the title (Set a clear title describing the issue) Ephemeral messages with inputs dont Dissapear Jan 8, 2025
@seratch seratch added question M-T: User needs support to use the project web-client Version: 3x and removed untriaged labels Jan 8, 2025
@seratch seratch changed the title Ephemeral messages with inputs dont Dissapear Ephemeral messages with inputs don't disappear Jan 8, 2025
@seratch
Copy link
Member

seratch commented Jan 8, 2025

Hi @fmPeretti, thanks for asking the question!

In general, ephemeral mesasges can stay remained even when you reload the Slack UI. It will eventually disappear, but there is no specific amount of time until its removal.

If you want to manage when to delete an ephemeral mesage upon user interactions, one solution is to post the ephemeral message using bolt-python's respond() utility (or if you don't use bolt-python, you can directly use response_url in a payload) and then call respond() with delete_original=True in response to a user interaction.

Please note that there is no way to delete the message when you post the message using chat.postEphemeral API. Also, respond() (more specifically response_url in a payload from Slack) is usually available only for app.action (block_actions), app.command (slash command), app.shortcut (message shortcut) listeners. You can't use it with app.event / app.message (Events API). So, for your use case, the following operation should work well:

  1. Post an ephemeral message using respond() in response to a button click / slash command / message shortcut invocation
  2. Update/delete the ephemeral message using respond() w/ replace_original/delete_original=True when the click event on the message comes to your endpoint

If you didn't intend to ask how to handle interactions with an ephemeral message, please feel free to ignore the above suggestion. I hope this was helpful to you.

@fmPeretti
Copy link
Author

fmPeretti commented Jan 13, 2025

HI @seratch thanks for answering my question, from what i could understand from the slack documentation that ephemeral messaged lasted aslong as the user session.
https://api.slack.com/methods/chat.postEphemeral. 👇
image

The case is that for me, the ephemeral messages that have input fields in it NEVER dissapear while the others, that has been sent at the same time, do Dissapear.
I have 30 days old ephemeral message that didnt dissapear. I understand theres no real or estimate amount of time a ephimeral message can last but I would hope them to go away eventually.

Also I understand the workarrounds you propose, but im using this to drive some workflow where the user inputs some data, to a form like message thats ephemeral. I would want that inputs to dissapear over time and i do not want to persist anything about the process which would allow me to delete the message manually later.

@fmPeretti
Copy link
Author

*For some reason those have disappeared now! Im not quite sure to understand why.
I had the specific slack workspace completely removed and added again. Im not 100% sure if that was what made the Ephemeral message finnally go away, But anyways the behavior is quite funny.

Might be worth to add a little asterik to the documentation on What is considered a "reload" or a "session".

Thank you for your help! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question M-T: User needs support to use the project Version: 3x web-client
Projects
None yet
Development

No branches or pull requests

2 participants