Can you try using "" around content instead of ''
$attachment->title('Exception: File Not Found', $url)
->content("This is a line of text.\nAnd this is another one.")
->markdown(['text']);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
According to the Laravel docs you can parse markdown in Slack using...
$attachment->title('Exception: File Not Found', $url)
->content('File [background.jpg] was *not found*.')
->markdown(['text']);
Also in the documentation you are directed to Slack's formatting page for more info on how to format Slack notifications here:
https://api.slack.com/reference/surfaces/formatting#message_formatting
There is says you can add new lines of text by doing this...
You can use multi-line text in app-generated text. Insert a newline by including the string \n in your text.
$attachment->title('Exception: File Not Found', $url)
->content('This is a line of text.\nAnd this is another one.')
->markdown(['text']);
Suffice it to say this doesn't work. No new line, it just outputs "This is a line of text.\nAnd this is another one." in the Slack message. =T
Does anyone know how I can add a new line in my Slack notification content? Is it possible?
Can you try using "" around content instead of ''
$attachment->title('Exception: File Not Found', $url)
->content("This is a line of text.\nAnd this is another one.")
->markdown(['text']);
Please or to participate in this conversation.