Serverhooks with external platform

  • Ok I have been slamming my head against this for a few days now since I am fairly new to and the nodebb framework. Hoping I can get some ideas.

    Basically all I am trying to do is get a nodebb serverhook to work with another platforms hook. The hook I am using is

    I have my plugin.json serverhook calling to my library.js fine. The problem is trying to pass the data to the other platform.

    I can do it all day long client side with something like:
    $.post( url, embed2 );

    I guess my question really is, how the heck can I "post ( equivalent?)" from my plugin in a serverside script?

    I have been searching for hours and I bet I missed something. Any help is appreciated.

  • Or is there a hook that I am missing that fires clientside when the user posts a new message? I have tried "" which fires when you click new or reply not submit.

  • Can you post your existing code? It's difficult to understand what you're trying to do without some kind of example.

    Maybe a pseudo-code example would also be helpful.

  • My code is extremely mangled at the moment.

    Basically what I am attempting to do is whenever a user posts I want an update to be pushed to a Discord channel. I have the Discord hooks working perfect. But sending the data through the nodebb hook is becoming a task.

    The only information I require is how to push the data to Discord from the nodebb server side.

    Should I be using nodejs http to send the data?

  • Example:


      "id": "nodebb-plugin-nubhook",
      "name": "nubHook",
      "description": "blablabla",
      "url": "removed for priv",
      "library": "./library.js",
      "hooks": [
        { "hook": "", "method": "discordHooker" },
        { "hook": "static:app.load", "method": "init" }
      "scripts": [


    var NubHook = {
           discordHooker: function(postData) {
    //send to discord plox
    module.exports = NubHook;

  • @Cepheus If you need to make a post request, I'd suggest using the request library.

    So in your plugin you have something like:

    var request = require('request');
    function onPostSave(params) {
      var post =;
      var data = {
        url: '',
        // extract data from post to send to discord
   , function (err, res, body) {
        // do stuff with the response

  • Alright, thanks for the help!

  • GNU/Linux Admin

    Seconding the recommendation to use request. That's the server side equivalent to making an xhr on the client side.

Suggested Topics

| | | |