Open ocean90 opened 5 years ago
Relevant code:
One ida would be to check first if a property like fallback
, color
or fields
is set on $attachment
. If set, do nothing and just merge into the new array. Otherwise use the current way as a fallback.
Hi @ocean90, Soon i will release an updated version with more control of the notifications.
I’m interested in actions as well, particularly approve/spam/trash for comments. I’m willing to submit a PR if you’ll consider it for use in the plugin.
Hi @macbookandrew, I need to see how to embed the actions, It will be released in a future version.
Do you have a list of actions you would like to see?
Some actions I’d like:
I looked at the code a bit and it appears you’re using the older attachments, and Slack has moved to a new blocks approach (upgrade notes: https://api.slack.com/messaging/attachments-to-blocks).
Do you anticipate switching to the blocks API or sticking with the attachments?
I will look into it. I can't promise it will be in the coming days, but I will release a new version in the following weeks.
Slack also has support for interactive messages which includes link buttons. Link buttons are added via attachments and the
actions
field. See https://api.slack.com/docs/interactive-message-field-guide#action_fields for more.Currently when passing an attachment array to
send_message()
it's not really treated as an attachment which Slack would expect. It's more of a "fields" array, so just one part of an attachment. I'd really like to see a way to pass a fully prepared attachment tosend_message()
. This would give you also the possibility to add many of the other supported properties.But for now, actions is probably something which the plugin itself would benefit from too. Imagine "View Order" or "View Post" buttons below some of the default notifications.
What are your thoughts on this? Happy to provide a PR for this once we have fleshed out the details. Thanks!
As a workaround I'm currently passing the actions in the
$args
parameter ofsend_message()
and extend the notification with the actions viaslack_after_notification_generation
.