# Opening a reply window via URL

**URL:** https://meta.discourse.org/t/opening-a-reply-window-via-url/44781
**Category:** Feature
**Tags:** composer
**Created:** [25 mei 2016 om 10:21 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781 "2016-05-25T10:21:42Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![yaodan](https://avatars.discourse-cdn.com/v4/letter/y/9fc29f/32.png) [@yaodan](https://meta.discourse.org/u/yaodan)
#### Post date: [25 mei 2016 om 10:21 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/1 "2016-05-25T10:21:43Z")

</div>

Hi All,

I know that we can [create a new topic via url with special param](https://meta.discourse.org/t/compose-a-new-pre-filled-topic-via-url/28074).  
**But I want my users to click a link to reply a specific topic. Is there a way to add special params in the url query to auto open reply window for my users?** If not, is there a way I can do this?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [25 mei 2016 om 23:23 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/2 "2016-05-25T23:23:39Z")

</div>

Yes, @techapj added this a while ago, details are here:

> [@Creating a link to start a new topic with pre-filled information](https://meta.discourse.org/t/compose-a-new-pre-filled-topic-via-url/28074):
>
> bookmark This documentation explains how to create a link that starts a new topic in Discourse with pre-filled information. person_raising_hand Required user level: All users Sometimes you may want to provide users with a link that opens a new topic composer with certain information pre-filled. This can be useful for various use cases including bug report templates, feature requests, or standardized posts. Constructing the URL Base URL To compose a new pre-filled topic with no extra i…

---

<div class="post-metadata">

### Author: ![yaodan](https://avatars.discourse-cdn.com/v4/letter/y/9fc29f/32.png) [@yaodan](https://meta.discourse.org/u/yaodan)
#### Post date: [26 mei 2016 om 01:38 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/3 "2016-05-26T01:38:51Z")

</div>

Hi Jeff,

Thank you for your reply, but what I want is that I want my users to reply  
a topic which has already been created by others.  
eg. I have a topic A in my forum, and I want every user click this link to  
reply under topic A, not to create another topic.

---

<div class="post-metadata">

### Author: ![yaodan](https://avatars.discourse-cdn.com/v4/letter/y/9fc29f/32.png) [@yaodan](https://meta.discourse.org/u/yaodan)
#### Post date: [26 mei 2016 om 01:41 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/4 "2016-05-26T01:41:00Z")

</div>

What I want is when I open this link, the reply window popup, I want this  
action equals to click the “reply” button under a topic.

---

<div class="post-metadata">

### Author: ![magoz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/magoz/32/80046_2.png) [@magoz](https://meta.discourse.org/u/magoz)
#### Post date: [18 maart 2018 om 22:43 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/5 "2018-03-18T22:43:29Z")

</div>

It has been a while and I haven’t found a way to do it.  
I just want to be able to create a link that when clicked opens a specific topic with the reply box activated and with the focus on it.

Something like:  
[https://meta.discourse.org/t/how-to-open-reply-window-via-url/#reply](https://meta.discourse.org/t/how-to-open-reply-window-via-url/#reply)

Anyone knows how can it be achieved?  
Thanks,

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [19 maart 2018 om 21:48 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/6 "2018-03-19T21:48:05Z")

</div>

> [@magoz](#):
>
> when clicked opens a specific topic with the reply box activated and with the focus on it.

What [I posted above](https://meta.discourse.org/t/how-to-open-reply-window-via-url/44781/2) works, but remember _you don’t need to be on a specific topic to reply to it_.

If your requirement is “must navigate to topic page, and then open the composer to reply”, then we don’t have that.. but again it’s not required, you can reply to any topic from any other topic (or any location in the Discourse app, in fact) in the composer.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [19 maart 2018 om 22:16 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/7 "2018-03-19T22:16:10Z")

</div>

That post only mentions new-topic, where is the handy url to post a reply?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [19 maart 2018 om 22:34 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/8 "2018-03-19T22:34:22Z")

</div>

I believe there is one, cc @techAPJ

---

<div class="post-metadata">

### Author: ![magoz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/magoz/32/80046_2.png) [@magoz](https://meta.discourse.org/u/magoz)
#### Post date: [19 maart 2018 om 23:24 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/9 "2018-03-19T23:24:41Z")

</div>

> [@codinghorror](#):
>
> If your requirement is “must navigate to topic page, and then open the composer to reply”, then we don’t have that… but again it’s not required, you can reply to any topic from any other topic (or any location in the Discourse app, in fact) in the composer.

I’m aiming to use that link _outside_ of Discourse. For example, putting a link on my blog, and when clicked it opens a new tab and starts a reply on a particular topic of the forum.

Is there a way to do it?

Thanks for your help.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [19 maart 2018 om 23:32 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/10 "2018-03-19T23:32:23Z")

</div>

Yes, the answer above works as you describe. Perhaps @techapj can help me explain because I seem to be failing at explaining this at the moment.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [20 maart 2018 om 05:49 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/11 "2018-03-20T05:49:07Z")

</div>

The feature we have right now only supports _creating new topic_ via URL.

What @magoz wants is to have a URL for an existing topic that will open composer and user can start replying on that topic as soon as they visit that URL. This is currently not available and is not on my list right now.

Should we add support for this feature?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [20 maart 2018 om 05:53 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/12 "2018-03-20T05:53:36Z")

</div>

Not sure about it seems very uncommon

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [20 maart 2018 om 06:19 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/13 "2018-03-20T06:19:34Z")

</div>

My bad @magoz I was indeed misunderstanding. I could have sworn we had a pre-filled reply URL though.

---

<div class="post-metadata">

### Author: ![magoz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/magoz/32/80046_2.png) [@magoz](https://meta.discourse.org/u/magoz)
#### Post date: [17 april 2018 om 14:21 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/14 "2018-04-17T14:21:17Z")

</div>

Apologies for my late reply.

Opening the composer (in a blank state) from an URL would be useful for those who have external websites working with Discourse and ask their users to reply to a particular Discourse topic.

For instance, I have a private website where I teach online lessons. I ask my students to reply to specific discourse topics to introduce themselves, to post their homework, etc.

It would be nice to be able to add something like `?reply` at the end of any topic’s URL, and share that link with them.

For example:

```
<a href="https://meta.discourse.org/t/how-to-open-reply-window-via-url/44781?reply">link</a>

```

It would open a new reply to that topic with the composer open.

---

<div class="post-metadata">

### Author: ![exetico](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/exetico/32/119962_2.png) [@exetico](https://meta.discourse.org/u/exetico)
#### Post date: [15 mei 2018 om 17:22 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/15 "2018-05-15T17:22:29Z")

</div>

I would love to see it, too. Including template-support for answers, so it’s not just for topics 🙂

---

<div class="post-metadata">

### Author: ![jord8on](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jord8on/32/166809_2.png) [@jord8on](https://meta.discourse.org/u/jord8on)
#### Post date: [6 april 2020 om 19:00 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/16 "2020-04-06T19:00:58Z")

</div>

Is this possible now?

We would love to see this feature as well 🙏 Would it take a lot of extra work to make this possible, if it’s not already?

Some of our community members are thought leaders or SMEs that run YouTube Live sessions, which is okay (at best) for Q&A and turrrrrible for deeper discussion.

We want to be able to direct users to post their questions to an existing Event Topic (where we’ve used [the events plugin](https://meta.discourse.org/t/events-plugin/69776)) and have the reply window pop up, and ensure that the folks with the questions are posting to the respective SMEs topic.

One of our big value adds to a lot of the folks we’re working with is that we provide a place where they can engage with their users in deeper discussion.

When they do a YouTube or FB live, they are merely STARTING the conversation. Discourse is the perfect tool to CONTINUE the conversation.

If we could simplify the process by having giving a direct URL that people can click, and we can pre-open the reply dialog box, and pre-fill it with some boilerplate text, that would be so helpful!!

---

<div class="post-metadata">

### Author: ![Judith](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/judith/32/289903_2.png) [@Judith](https://meta.discourse.org/u/Judith)
#### Post date: [10 februari 2021 om 12:40 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/17 "2021-02-10T12:40:33Z")

</div>

Same. It would be super-useful for our community.

---

<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: [10 februari 2021 om 14:12 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/18 "2021-02-10T14:12:01Z")

</div>

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 the composer with a new empty reply.

If you need some pre-filled text it is doable by setting the `reply` attribute on the object passed to `composer.open`. Plus, if there’s already a draft for that topic, it will ask if you want to save/discard it before creating this new reply – `draftSequence` needs to be correct if the desired behavior is resuming that draft.

```js
<script type="text/discourse-plugin" version="0.4">
  if (/.*#reply$/g.test(document.URL)) {
    const { REPLY } = require('discourse/models/composer').default;
    
    const composer = Discourse. __container__.lookup('controller:composer');
    
    setTimeout(function() {
      const topic = Discourse. __container__.lookup("controller:topic").get("model");
      if (topic) {
        composer.open({
            action: REPLY,
            draftKey: topic.draft_key,
            draftSequence: topic.draft_sequence,
            topic,
        });
      }
    }, 0)
  }
</script>

```

I hope that helps.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [16 januari 2023 om 23:17 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/20 "2023-01-16T23:17:33Z")

</div>

> [@renato](#):
>
> 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`.

Have you changed / updated this since? It would be really useful - I’ve just found a use-case for it in my instance:

> giving people a nice one click way to reply to a banner topic

---

<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: [17 januari 2023 om 12:53 UTC](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781/21 "2023-01-17T12:53:13Z")

</div>

> [@nathankershaw](#):
>
> Have you changed / updated this since?

The only change I recall doing was enforcing the login flow if the user isn’t already logged in, something like:

```js
        if (!Discourse.User.current()) {
            Discourse. __container__.lookup("route:application").send("showLogin");
        }

```

I still use it in my community to take users from my React app directly to some of these flows on Discourse (reply, edit, upload, etc).

[Next page](https://meta.discourse.org/t/opening-a-reply-window-via-url/44781.md?page=2)
