Save chat information between users?

  • @a_5mith ok thank you

  • Not sure if I get what you mean. Record as in save a history in the ACP for the admin to troll over? In any case I imagine it should be as easy as adding an action hook into the chat method and going from there

  • @psychobunny yeah and maybe record some statistics like how many times user1 has messaged user2. I'm new to NodeBB but I would love to implement it into one of my programs as I think it would be a great fit. Do you mind elaborating a bit more on how I would go about adding an action hook into the chat method?

  • Seems like there's already a hook 😉

    found at

    Your plugin would just have to listen to that hook. The message object contains fromuid, touid, timestamp, and content, pretty much everything you'd need to write a decent enough analytics plugin 👍

    EDIT: we have a plugin contest coming up soon, perhaps you'd want to register and try your luck 😉

  • @psychobunny thank you!! 🙂

  • @psychobunny I can't seem to get it working, do you mind helping me a bit? I followed this tutorial and got the library.js file to print out "hello, world!" as soon as the plugin is loaded. But after I try adding the "" hook into the plugin.json file, "hello, world!" never gets printed. Here are my library.js and plugin.json files:

    "id": "nodebb-plugin-test",
    "name": "NodeBB Messaging Stats Plugin",
    "description": "NodeBB testing Plugin",
    "url": "",
    "library": "./library.js",
    "hooks": { "hook": "", "method": "myMethod"}

    var MyPlugin = {

    myMethod: function(message, next) {
    	//do something with message here
    	console.log('***************hello, world!*****************');


    any help will be appreciated, thanks..!

  • Does the chat still work as normal?

    EDIT: is that the full library.js file? You're missing the module.exports = MyPlugin line at the bottom

  • @psychobunny Thanks! that's what I was missing. It's working now 🙂
    for anybody interested, here's how my files look now:


    	"id": "nodebb-plugin-youtube",
    	"name": "NodeBB YouTube Plugin",
    	"description": "NodeBB Plugin that allows users to embed YouTube videos inline in their posts.",
    	"url": "",
    	"library": "./library.js",
    	"hooks": [
    		{ "hook": "", "method": "myMethod", "callbacked": true, "priority": 6 }


    (function(module) {
    	"use strict";
    	var myPlugin = {};
    	myPlugin.myMethod = function(message, callback) {
    		callback(null, message);
    	module.exports = myPlugin;

    @psychobunny I'll look into that plugin contest even though, I'm extremely new to NodeBB and only have basic JavaScript skills! 😄

  • This would make for an interesting plugin. While I dont agree with admins browsing user chats, sometimes it can be necessary to settle disputes.

  • @Ted yeah, and also the way I'm using the chat is not necessarily for casual conversations; statistics/logs from chat are needed 🙂

Suggested Topics

| | | |