Make an external http request from discourse

I’m thinking of replacing an existing website with discourse. The problem is the backend of that site contains a shared logic even for a mobile app and specific actions for the site.
So, having to keep an active server with that particular logic, I wonder if it is possible to send http requests from discourse to an external server. The ideal would be that at the occurrence of certain discourse events make a http request to my server.

Is this actually possible? If yes there is somewhere a guide?

Also is it possible to create a topic with specific fields and pass them into the http request?


It’s perfectly possible, write a plugin.

Here’s an example of a plugin which makes an external call whilst processing oneboxes.


I think what you’re trying to do is closer to the concept of webhooks. You need to write some webhooks which hit the given urls when an event occurs. If thats the case, you can have a look at this.


Yep, if the communication is one way, @fzngagan’s proposal is better.

If you want to retrieve and process a response in some complex fashion, then a REST call in a plugin might be better.


Thank you everyone for the answer. No, I’m looking for a way to create a full API REST client and not a simple webhook.
What i am trying to replicate is a sort of marketplace when users can post their objects and then they can accept the various offers from others users. The logic of the marketplace should remain on the server but the front end should be discourse and so it should be updated according to the data on server.

I honestly don’t know what’s better to do for this situation, so i am looking for tips and references!

I also link to you the site (it is in italian) just to let you understand better what i am trying to migrate

I think some clarification is required in terms of what role Discourse would play here.
How does your use case relate to discussion/conversation. What would be done on discourse and what would be done on your server.

This is a broad statement. Discourse in itself is a whole system. What data would you show on Discourse which comes from or is synced with your other server.

From the information you’ve shared, it could be done via a plugin for sure. There are integrations for WordPress, GitHub, etc which might be doing a similar thing what you’re trying to do. But that’s me trying to read between the lines.

If you want to understand how to build plugins, here’s a great collection of links by @merefield

This is also a good one.

1 Like

Ok, let me explain better from the beginning the idea:

I want to create a marketplace where users can sell or trade their items. Ideally every time a user creates a post he should enter specific fields to describe this object. Other users should have the opportunity to discuss the price of this item and bid through specific buttons and fields (which should be added using discourse).

Starting from this idea there are two ways I could take (if discourse allows it):

  1. Every time a discourse interaction is made about such offers I would like my server to update or send the data.

Or, in case the above thing is not possible:

  1. I would like to transfer all the logic to discourse using its internal database and I would like to create a service API rest on discourse that allows a mobile application to connect and use the service from mobile phone.

What is the better and fast idea to implement using discourse?

1 Like

This is a preferable way to go. The reason being, Discourse isn’t a marketplace and it wouldn’t make much sense to tweak it to behave like one.

Also, do you wish to write the code yourself or hire someone to do that?

1 Like

Perfect, so if is possible to do that in discourse, what is the best way to do that?

Since this is not meant to have any revenue and since I have experience in coding is my idea to write all by myself.


I think you should read the links shared above. Also, this wordpress plugin does a similar job but for wordpress so you can check that too.