Creating new Discourse topics via URL

As part of my experiment in using Discourse as a notes app, I realized it’s paramount that it’s super easy to create new notes/topics in my personal instance of Discourse. Luckily, the Discourse team makes it easy. :wink:

https://example.com/new-topic?title=TITLE&body=BODY

So I took this URL scheme and created a new Drafts action (naturally) that follows this scheme so that I can quickly send things there. Here’s what mine looks like:

https://notes.joebuhlig.com/new-topic?title=[[title]]&body=[[body]]

I should also note that you can pass category and tags to this URL as well. That way you can categorize these from the onset. I simply prefer to treat uncategorized as in inbox.

As an example of how this works, click the following link to create a new topic here on the :guild::

https://community.effectiveremotework.com/new-topic?title=My%20iPhone%20Home%20Screen&category=home%20screens

https://community.effectiveremotework.com/new-topic?title=My%20iPhone%20Home%20Screen&category=home%20screens

There are more details on the Meta forums here:

2 Likes

Last night I started a Discourse instance based on your theme and so far it’s been great, so thank you for introducing me to this concept.

A question I have is if there is a way to post directly to Discourse from Drafts without having to be redirected to the website?

In my other note taking process I send it to the service either in the background or via X-Callback-URL schemes so I end up back in Drafts almost immediately any suggestions?

1 Like

I use a Drafts action with one URL step. See below:

It doesn’t just dump it in Discourse; instead it loads a topic window where you can add metadata or save it right away to deal with later.

Technically, yes. You could set up a URL that uses an API key and POST it to your Discourse instance to create it all at once without the redirect.

1 Like

Couldn’t help myself. If you create a new Drafts action with the following script:

var url = “https://discourse.example.com/posts”;

var http = HTTP.create();

var response = http.request({
“url”: url,
“method”: “POST”,
“data”: {
“title”: draft.title,
“raw”: draft.content,
“api_key”: “YOUR_DISCOURSE_API_KEY”,
“api_username”: “YOUR_USERNAME_ON_DISCOURSE”
},
“encoding”: “form”
});

This will drop it into Discourse without ever leaving Drafts. :wink:

1 Like

Thank you, you’re the best! This is working perfectly, I really appreciate it.

1 Like