The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-action-links
Rodrigo Nascimento d31f8658dc Some improvements from `more-streams` (#4510) 10 years ago
..
client Action links improvements 10 years ago
server Some improvements from `more-streams` (#4510) 10 years ago
README.md initial add of Action Links 10 years ago
loadStylesheets.js initial add of Action Links 10 years ago
package.js Remove less and api.versionsFrom fixed versions 10 years ago

README.md

RocketChat Action Links

Action Links are a way to add custom javascript functions to RocketChat messages. The links appear as a horizontal list below the message they correspond to, and by clicking the link will run a function you define server-side.

Usage

Add 'actionLinks' to any message object as in the example below. It should be an array of object, each containing a 'label' (this will be the text printed to click on), a method_id (this is the name of the method that will be run), and params (this is the parameters passed to the method_id function).

message.actionLinks = [{ label: "Another Option", method_id: "anotherFunction", params: "stuff"}, { label: "An Option", method_id: "functOne", params: ""}];

The functions to be run need to be added to the actionLinkFuncts namespace. This is done by calling the RocketChat.actionLinks.register method. Your custom functions should take two parameters: the original message from the database, and the 'params' object given for that function.

RocketChat.actionLinks.register('functOne', function (origDbMsg, params) {
		
	console.log("I did some stuff!");

});