Closed stoiveyp closed 4 years ago
This is a blocker for me. Attachments is unfortunately the only way of getting the left side colored line in messages that's so wide spread.
The even went so far as to support attachments inside blocks now, so I'm guessing it's not going away any time soon.
Hi @rasmuskl
Not sure I recognise the colored line you're mentioning in your message, certainly not something I rely on in any of my slack groups. Could you post an example image when you get the opportunity? Be good to understand your use case.
I must admit at the moment I rely on https://api.slack.com/methods/files.upload and the equivalent in the library to get attachments into messages. Certainly the files block element isn't reliant on secondary attachments to work, but it's good to know that there's an interest in getting it supported.
Definitely bumps it up my list of outstanding issues, so thank you for reaching out 👍
The green line on the left of this message is made with an attachment and can't be made with blocks.
Example from the link you provided.
I was able to work around it by using your client directly with a class like this:
public class PostMessageAttachmentRequest : PostMessageRequest
{
[JsonProperty("attachments", NullValueHandling = NullValueHandling.Ignore)]
public List<Attachment> Attachments { get; set; } = new List<Attachment>();
}
public class Attachment
{
[JsonProperty("color", NullValueHandling = NullValueHandling.Ignore)]
public string Color { get; set; }
[JsonProperty("blocks", NullValueHandling = NullValueHandling.Ignore)]
public List<IMessageBlock> Blocks { get; set; } = new List<IMessageBlock>();
}
That's a great example - thank you @rasmuskl! Not something I've ever noticed, but if you rely on it then that'd be a big difference certainly.
Appreciate you taking the time, thank you :+1:
Fixed in 2.1.0
It's legacy - and I'd rather just keep support for blocks, but it feels like it may be required https://api.slack.com/reference/messaging/attachments