npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mattermoster-todo-plugin

v1.0.0

Published

ToDo plugin for 'mattermoster-base' based on Node.js + Express + MySQL

Downloads

4

Readme

Mattermoster ToDo Plugin (mattermoster-todo-plugin)

ToDo plugin for Mattermoster based on Node.js + Express + MySQL.

Mattermoster is a Node.js + Express base API for Mattermost slash command integrations.

Mattermost is an Open source, private cloud Slack-alternative.

Features

  • Use the same MySQL database server you use for Mattermost
  • i18n ready
  • Open source!

Installation

$ npm install --save mattermoster-todo-plugin

Adding plugin to Mattermoster

// ...

/**
 * Mattermoster todo plugin
 */
const todoPlugin = require('mattermoster-todo-plugin');
const endpoint = '/todo'; // you can change this
mattermoster.addPlugin(endpoint, todoPlugin);

// ...

mattermoster.init();

MySQL database

--
-- Schema creation
-- Replace 'DBNAME' below with your desired database name
--
CREATE SCHEMA DBNAME DEFAULT CHARACTER SET utf8 ;
USE DBNAME;

--
-- User creation
-- Replace DBUSER, DBPASS and DBNAME with your own
--
CREATE USER 'DBUSER'@'localhost' IDENTIFIED BY 'DBPASS';
GRANT ALL PRIVILEGES ON 'DBNAME'.* TO 'DBUSER'@'localhost';
FLUSH PRIVILEGES;

--
-- 'todo' table creation
--
CREATE TABLE `todo` (
  `id` INT NOT NULL,
  `title` VARCHAR(30) NOT NULL,
  `description` VARCHAR(120) NULL,
  `status` VARCHAR(30) NOT NULL,
  `completed` TINYINT NOT NULL DEFAULT 0,
  `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`));

The MySQL connection class will use this parameters:

Parameter | Environment variable | Default value --------- | --------------------------|-------------- host | DB_MATTERMOSTER_TODO_HOST | localhost port | DB_MATTERMOSTER_TODO_PORT | 3306 user | DB_MATTERMOSTER_TODO_USER | mattermoster password | DB_MATTERMOSTER_TODO_PASS | mattermoster database | DB_MATTERMOSTER_TODO_DB | mattermoster

If you use a parameter with a non default value, you must set the corresponding environment variable.

Usage

To create a Custom Slash Command, follow this instructions from Mattermost documentation:

In Mattermost client (web or desktop application)...

1 - First, go to Main Menu > Integrations > Slash Commands. If you don’t have the Integrations option in your Main Menu, slash commands may not be enabled on your Mattermost server or may be disabled for non-admins. Enable them from System Console > Integrations > Custom Integrations or ask your System Administrator to do so.

2 - Click Add Slash Command and add name and description for the command.

3 - Set the Command Trigger Word. The trigger word must be unique and cannot begin with a slash or contain any spaces. It also cannot be one of the built-in commands.

Note:

Mattermoster ToDo Plugin **Command Trigger Word** is dependent on language set on Mattermoster API project.

To find out **Command Trigger Word**, navigate to Mattermoster_API_root > node_modules > mattermoster-todo-plugin > locales. Open the XX.json file of the language you set (defaults to 'en.json').

In XX.json look for "slash_command".

This is the **Command Trigger Word** you must use in Mattermost.

4 - Set the Request URL and Request Method. The request URL is the endpoint that Mattermost hits to reach your application, and the request method is either POST or GET and specifies the type of request sent to the request URL.

Note:

This is the host:port of your Mattermoster API server.

**Request Method** must be set to POST.

5 - (Optional) Set the response username and icon the command will post messages as in Mattermost. If not set, the command will use your username and profile picture.

6 - (Optional) Include the slash command in the command autocomplete list, displayed when typing / in an empty input box. Use it to make your command easier to discover by your teammates. You can also provide a hint listing the arguments of your command and a short description displayed in the autocomplete list.

7 - Hit Save.

You are done. Now try your new Custom Slash Command in any channel or direct message in Mattermost.

Development

Want to contribute? Great, we are waiting for your PRs.

$ npm install --save mattermoster-todo-plugin
$ npm run dev

Todos

  • Write tests
  • Expand troubleshooting section

Troubleshooting

If you are running Mattermoster in the same machine that is running Mattermost, you must modify Mattermost's config.json file to allow unstrusted internal connections.

License

MIT

Free Software, Hell Yeah!