I am trying to post messages to slack https://api.slack.com/methods/chat.postMessage/test
i am adding attachment [{"pretext": "pre-hello", "text": "text-world"}]
but in slack channel UI i am seeing close icon, if i click close icon i can able to remove attachment
How can i disable close icon, so that no one can't delete attachments?
There is a workaround if you remove "text" node, attachments can't be deleted. So you can put "pretext" on first attachment to have same behavior.
Here you can delete attachements (Sample)
{
"text": "Hello",
"attachments": [
{
"text": "Hello World"
},
{
"text": "Hello World"
}
]
}
Here, you have the same message but without close icons this time (Sample)
{
"attachments": [
{
"pretext": "Hello",
"text": "Hello World"
},
{
"text": "Hello World"
}
]
}
You can not disable the close icon for attachments. But: Only those members will actually see the close icon, which also have the permission to delete the whole message. Depending on workspace settings only the message owner and members with admin / owner role can delete a message.
So, most Slack users will not be able to delete attachments posted by your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With