Compose a new pre-filled personal message via URL


(Arpit Jalan) #1

Discourse now supports composing a new (pre-filled) personal message via URL! :sunny:

To compose a new pre-filled message, modify URL params like this:

http://discourse.example.com/new-message?username=techapj&title=message%20title&body=message%20body

This will open a composer window pre-filled with username, title and body.

Try it out live on try.discourse.org! :smile:

http://try.discourse.org/new-message?username=rudy&title=message%20title&body=message%20body



Starting creating a new private message via link?
Private Message Button on topic authors posts - Code Review Request
Link to private message a user from outside
(Mailing List) Link to private message
Move '+ New' Button to Top of Custom Group Page
Link to private message a user from outside via URL
How to go about hosting a design contest?
Possible to compose pre-filled MULTI user private message via URL?
Link to user profile page with "send message" window already open
Private Message Button in Posts or "Post Menu" area
Any way to automatically hide topics?
Private message composition URLs don't work with SSO
Hidden replies? Looking for a way to make a secret poll
Allow sending Private Messages to Staff
(Arpit Jalan) #2

I just added support for composing a new pre-filled message for a group via URL! The URL will be:

https://meta.discourse.org/new-message?groupname=team&title=topic%20title&body=topic%20body`

Notice groupname param in above URL, this means that you want to create a new pre-filled message for a group (as opposed to username for composing a message for user).


Private messages to a group, or other means to handle private support requests
"See my Posts Only" Category - Why not?
Private message via URL doesn't work for automatic groups
Opening a pre-filled message form no longer works
(Michael Downey) #3

How would someone create a URL to compose message to multiple recipients or multiple groups?


(Jeff Atwood) #4

Maybe @techapj can add support for comma (or semicolon) delimiting destinations here?


(Jeff Atwood) #6

Is this still on your list @techapj as I think it makes sense. Commas are not allowed in usernames, either comma or semicolon should be supported for this.


(Arpit Jalan) #7

Yes, this feature is still on my list.

This got delayed because currently we are verifying

  • user exists and if current user can send PM to desired user
  • group exists and is mentionable

Now this needs to be verified for multiple users and groups. Will get to it this week.


(Jeff Atwood) #8

Actually you can push it back, if it is a lot of work there are other things we can do first.


(Tobias Eigen) #9

Thanks for creating this nifty feature - it’ll come in handy!

I noticed that selecting this URL will take you to the site homepage and open up the message composer. Much more friendly, methinks, would be to take you to the destination user profile.


(Tobias Eigen) #10

In addition, if you’re not logged in it takes you to the homepage and displays the popup login window. Or for SSO it redirects to the login page. More friendly would be to display a message e.g. “you need to log in first before you can send a message.”

Also - I wonder what would happen if you’re logged in but TL0 and not yet allowed to start new messages. I’ll test that today.


(Simon Cossar) #11

With sso you can llink to yourdomain.com/session/sso and then set the return path to create the private message. If the user is already logged in they will be redirected automatically to the url supplied by the return path. If they aren’t logged in they will be taken to the sso login page and then redirected to the return path url.

href="http://localhost:3000/session/sso?return_path=http%3A%2F%2Flocalhost%3A3000%2Fnew-message%3Fusername%3Dscossar%26title%3DInformation+requested+about+gentle+yoga+classes">

The return path will need to be url encoded. Here is some example code in php:


(Tobias Eigen) #12

This worked! :rocket: Many thanks, @Simon_Cossar!

Now I just need to find a way to have it go to the member’s summary page and pop up the message composer instead of to /latest. @techAPJ any suggestion?


(Pad Pors) #13

TL0 users can contact admins in the form of replying to welcome message. it would be great if contacting site admins via a pre-filled private message would be permitted even for TL0 users.

then as an admin one can make a simple “contact us” link.


(Tobias Eigen) #14

You could do this with a category configured to allow anonymous posting by email and to give access to only the team members who should receive and handle inquiries. It will additionally create staged accounts which is cool.


(Pad Pors) #15

I just found out about the staged users ability and yes, it’s a nice feature! thanks for the suggestion :smiley:

a question regarding this method:

it’s like asking people to send an email to test@test.com in order to contact us. the only difference would be that we receive their response in the platform rather than our email.

isn’t it?

I’d like the users to be able to contact us via the platform itself.


(Jeff Atwood) #16