# How to have a reply link with pre-filled information?

**URL:** https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209
**Category:** Support
**Created:** [May 26, 2022, 10:54pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209 "2022-05-26T22:54:59Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mksafi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mksafi/32/244062_2.png) [@mksafi](https://meta.discourse.org/u/mksafi)
#### Post date: [May 26, 2022, 10:54pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209/1 "2022-05-26T22:54:59Z")

</div>

Been doing a lot of work around Discourse lately and really love the software! Very well thought out, thank you!

One feature request: a link that automatically opens the reply composer, or asks the user to login and redirects them to the reply composer after a successful login. Basically exactly like [Creating a link to start a new topic with pre-filled information](https://meta.discourse.org/t/how-to-create-a-new-topic-link-with-pre-filled-information/28074) but for replies.

Thank you!

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [May 26, 2022, 11:43pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209/2 "2022-05-26T23:43:41Z")

</div>

I use something like this:

> [@Opening a reply window via URL](https://meta.discourse.org/t/how-to-open-reply-window-via-url/44781/18):
>
> I use a simple theme component for this in my instance. Below is an adaptation from mine – which also accepts #upload (a new reply opening the upload window on desktop) and #edit (for wiki OPs) in addition to #reply. It needs some work, like avoiding setTimeout and correctly managing draftSequence (I don’t think topic.draft\_sequence is right), and I don’t know what would be the best practice here. That said, it’s working fine for me. Navigating to any topic like /t/[slug]/[id]#reply will open …

---

<div class="post-metadata">

### Author: ![mksafi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mksafi/32/244062_2.png) [@mksafi](https://meta.discourse.org/u/mksafi)
#### Post date: [May 27, 2022, 2:54pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209/3 "2022-05-27T14:54:41Z")

</div>

This seems to work. I added the code in the API initializer of my theme. Thank you!

---

<div class="post-metadata">

### Author: ![mksafi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mksafi/32/244062_2.png) [@mksafi](https://meta.discourse.org/u/mksafi)
#### Post date: [May 27, 2022, 6:14pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209/4 "2022-05-27T18:14:08Z")

</div>

I just realized that this solution doesn’t ask the user to sign up or log in, if they’re not.

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [May 28, 2022, 6:10pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209/5 "2022-05-28T18:10:10Z")

</div>

I think you can have some logic in the theme component to show the login page if the user isn’t logged in.

What I currently do, linking from another site, is enforcing the login flow like this, but I’m not sure if this works if you’re not using SSO:

`SITE_URL/session/sso?return_path=/t/slug/id%23reply`

Having it in the theme component is better to avoid unnecessary redirects anyway, I’ll try improving it when I get a chance (I’ll comment here if I do).

---

<div class="post-metadata">

### Author: ![mksafi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mksafi/32/244062_2.png) [@mksafi](https://meta.discourse.org/u/mksafi)
#### Post date: [May 28, 2022, 6:31pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209/6 "2022-05-28T18:31:02Z")

</div>

> [@renato](#):
>
> What I currently do, linking from another site, is enforcing the login flow like this, but I’m not sure if this works if you’re not using SSO:
> 
> `SITE_URL/session/sso?return_path=/t/slug/id%23reply`

Just tried it. Returns a 404 since I don’t have SSO enabled I guess 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 27, 2022, 6:31pm UTC](https://meta.discourse.org/t/how-to-have-a-reply-link-with-pre-filled-information/228209/7 "2022-06-27T18:31:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
