zach
zach

Reputation: 802

updating/dismissing message after dialog submitted

Is there a way to do any of the following:

a. Update a chat message that initiated a dialog. b. Store "hidden" fields in a dialog.

Basically, I have a bot message that opens from a button on a message attachment. I know when the user clicks the button, I get the ts of the message and at that time I could alter it. However, the workflow is not complete until the user has submitted the dialog, but the submit on the dialog loses all the original_message stuff and the ts of the dialog being submitted no longer corresponds with the original, calling message.

If there was a mechanism to store hiddens, I could stash the original ts or the response url on the form itself.

Thanks! This is my first slack workflow, so any advise is appreciated as usual!

.....

The suggested duplicate answer refers to an interactive message, which I'm using to call the dialog already.

However, that isn't where my problem is, it is the dialog submission.

You don't have any access to the button elements on a dialog and the dialog element can only have 5 elements of type: text, select, text area. Plus it's a bit overkill considering that a action invocation from an interactive message actually includes the original message in the post back to your server.

Upvotes: 0

Views: 1225

Answers (1)

zach
zach

Reputation: 802

So slack dev support got back to me:

Thanks for writing in, this is a great question!

You can use the callback_id parameter when calling dialog.open to store a string that will help your app locate the message. This callback_id will be returned to you in the dialog submission.

In your case, you could store the original message's ts and channel_id so that > you can locate the message to update.

I hope this helps! Let me know if you have any further questions!

So, it's a bit hacky (imo), but i did get it to work so I thought I'd close this question in case anyone else ran into this.

I'm just parsing the original ts value inside the callback w/ some other data i can use when the form submits. The only limitation to this is that it only stores 200 characters but that should be sufficient considering that is in addition to the 5 fields you have on the dialog and the other stuff slack gives you in the post (user, channel, etc).

Upvotes: 1

Related Questions