Use URL to compose a new message, with `body` adding new lines

Hi,

First of all – thank you for the fantastic Discourse! It is literally outstanding!

Question: I am aware that you can pre-create a private message using URL, for example:

https://dom.com/new-message?groupname=staff&title=Help&body=OS

What I cannot make work, is &body param passing new lines to the message, I tried:

https://dom.com/new-message?groupname=staff&title=Help&body=OS\nType

… and:

https://dom.com/new-message?groupname=staff&title=Help&body=OS\\nType

… with no luck.

Is this even possible? If it is possible, could someone advise please?

1 Like

Hello Ilia :wave:t5:

Welcome here!

I believe the newline operator would not work in that way, and off the top of my head, I don’t have another option using the URL the way you have.

But looking at how you have written the URL, it seems you want to set a template users can use when they click the new topic link from where you set it. What I believe you can do here is use the topic template feature and set it for your preferred category where you want the new topic created, then you set this category in the pre-filled link.

How does this sound?

1 Like

Could you use the percentage code for new line? %0A%0D

Edit:

Using %0A gives a linebreak, and %0A%0D pops in a blank line space.

An example:

https://dom.com/new-message?groupname=staff&title=Help&body=Please%20include%20all%20relevant%20details.%0A%0DOS:%0ADevice:%0ABrowser:%0A%0DThe%20problem:

4 Likes

Thanks a lot, Jammy! This is exactly what I was looking for and not sure how I missed that in the first place.

Thanks, Osioke. I will certainly utilize topic template feature.

2 Likes