Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cowsay test bot for MatterMost outgoing webhook
var express = require('express');
var cowsay = require('cowsay');
var bodyparser = require('body-parser');
var app = express();
app.use(bodyparser.urlencoded({ extended: true }));
app.get('/', function (req, res) {
res.end('<pre>'+ cowsay.say({text: 'Moo'}) + '</pre>');
});'/cowbot', function (req, res) {
if (req.body.token === process.env.MATTERMOST_TOKEN) {
var text = req.body.text.replace(new RegExp('^' + req.body.trigger_word + '\ '), '');
return res.json({
username: 'cowbot9000',
text: '```\n' + cowsay.say({text: text || 'wat?'}) + '\n```'
res.json(['who are you?']);
server: 'staging', //''
email: 'you@urdomain.tld',
agreeTos: true,
approveDomains: [ 'urdomain.tld' ],
app: app
}).listen(80, 443);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.