I want to send some custom properties in the attachment for interactive messages and retrieve them back in the action response. is there a way to do this?
相关问题
- Decoding body parameters with Spring
- How to store configuration items in a Slack App
- Upload a file to slack with files.upload in PHP
- Creating a Slack Webhook programmatically
- Can I create a link on a web-page to dm someone on
相关文章
- Create and get new channel incoming webhook in sla
- can't open Slack dialog through google apps sc
- How to remove Ephemeral Messages
- Access Slack files from a slack bot
- Can a Slack bot get the thread id that a slash com
- How to upload files to slack using file.upload and
- How to set slack reminder for private channel
- How can I get my bot to ignore conversation until
Yes, that is possible. However, it only works well for small sets of data.
Assuming we are talking about buttons the normal approach would be to use the
value
field of an action to transfer custom data based on which button the user clicked back to your app. The field is a normal string within a JSON message, which is send by POST request to your app. So it can in principle contain a whole data set, not only a single value. All you need to do is include it in the button attachment that is send to Slack and your app will receive the respective value field back. (depending on what data you want to send you might need to encode it, e.g. you want to encode binary data into base64, so that is can be transferred as JSON string)I have used it successfully in one of my apps to transfer serialized objects containing information about the user's application context.
There is one caveat though, that caused me to later abandon this approach again. As I found out the field length is limited, so if your string is too long you might end up with truncated data. In my estimation the limit is about 2.000 chars, but I do not have a definitive number.
Instead of transferring all data in the attachment, I now keep the user application context in a server session (PHP) and only transfer IDs through the
value
field of my buttons.Conclusion: If you have small sets of data you can transfer them through the
value
field. If you have larger sets of data I would not recommend it.