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

hubot-slash-command

v1.0.1

Published

It redirects slash command of Slack and Mattermost to hubot message.

Downloads

6

Readme

hubot-slash-command

It redirects slash command of Slack and Mattermost to Hubot.
Outgoing webhook can not be used on the private channel, so use the slash command to accomplish the same thing.

See src/hubot-slash-command.js for full documentation.

Installation

In hubot project repo, run:

npm install hubot-slash-command --save

Then add hubot-slash-command to your external-scripts.json:

[
  "hubot-slash-command"
]

And restart Hubot.

Add Slash command

Add Slash command to Slack or Mattermost.

| Request URL | Request Method | |:--------------------------------------------------------------|----------------| | http(s)://(your hubot hostname):(port)/hubot-slash-command | POST |

Please write down token.

Environment variables

  • HUBOT_RESPONSE_TYPE default: in_channel - in_channel(Show a response message to all member) or ephemeral(Visible to ther user that issued the command).
  • HUBOT_RESPONSE_MESSAGE default: Okey, ${user_name} orders `${command} ${text}` - Format response message to chat.
  • HUBOT_RECEIVE_MESSAGE default: ${robot_name} ${text} - Format send message to Hubot.
  • HUBOT_SLASH_COMMAND_TOKENS default:none - Your tokens of slash command(comma separated).

Example for Environment variables

# the response messages will only be visible to the user that issued the command 
export HUBOT_RESPONSE_TYPE=ephemeral
# Response message format to Chat.
export HUBOT_RESPONSE_MESSAGE='${user.name} execute command on ${channel_name}'
# Send message format to Hubot.
export HUBOT_RECEIVE_MESSAGE='${robot_name} ${text}'
# Your tokens of slash command.
export HUBOT_SLASH_COMMAND_TOKENS=fpf9t5snkirmmyxanjj15o3uoh,ff33opd7q3nktx3jkoee17kbya

Variables for message

  • Variables from Hubot Robot object.

|Variable name|Parameter|Example| |:------------|:--------|:------| |${robot_name}|robot.name|Hubot | |${robot_alias}|robot.alias|mybot |

  • Variables from request parameter of slash command.

|Variable name|Parameter|Example| |:------------|:--------|:------| |${channel_id}| channel_id|C2147483705| |${channel_name}| channel_name|general| |${command}| command|/some_command| |${response_url}| response_url|https://hooks.slack.com/commands/12345678| |${team_domain}| team_domain|example| |${team_id}| team_id|T0001| |${text}|text|weater Tokyo| |${token}|token|gIkuvaNzQIHg97ATvDxqgjtO| |${user_id}|user_id|U2147483697| |${user_name}|user_name|Steve|

Usage

When executing the slash command, redirects arguments of slash command to Hubot.
If you input /some_command ping, send hubot ping to Hubot.

So you can get message by robot.respond(/ping/).

License

MIT