Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

white spaces - slack (webhook)

It looks like there is no option post a message containing a table on to slack. I am trying to build a table using text formatting. In the below example the text isn't aligned because first row has text ROW1 and second row has text ROW. Is there a way to add a white space after ROW in order to align this text?

{"text" : "ROW1\t\t\t\tCOL1\nROW\t\t\t\tCOL2"}

like image 580
Punter Vicky Avatar asked Feb 17 '26 08:02

Punter Vicky


1 Answers

Generally speaking, you can use Slack's message builder to test the rendering of your messages.

This being said, while I dont think you can simply "push" spaces to the right, you could use the pipe symbol like this :

"text": "ROW1|\t\t\t\tCOL1\nROW   |\t\t\t\tCOL2"

Another possibility, with minor changes, is to use attachements with fields like this

"attachments": [
        {
            "fields": [
                {
                    "title": "Col1",
                    "value": "text1",
                    "short": true
                },
                {
                    "title": "Col2",
                    "value": "text2",
                    "short": true
                }
            ]
        }
    ]
like image 158
Matthieu Avatar answered Feb 20 '26 12:02

Matthieu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!