From 26c35a9d716f5e71c78ee9c28b379d0644f6c6ce Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sat, 1 Apr 2017 18:45:22 -0700 Subject: [PATCH] Mattermost/Slack send a JSON payload for a Slash command --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 815ac03..78e6197 100644 --- a/index.js +++ b/index.js @@ -27,12 +27,12 @@ app.get( '/', function( req, res ) { // Parse POST body to create WP post app.post( '/log', function( req, res ) { // Don't bother if there's nothing to record - if ( 'undefined' === typeof req.body || ! req.body.length ) { + if ( 'undefined' === typeof req.body || 'undefined' === typeof req.body.text || ! req.body.text.length ) { return res.sendStatus( 400 ); } // Massage the title - var title = req.body; + var title = req.body.text; title = striptags( title, [] ); if ( title.length > 30 ) { @@ -43,7 +43,7 @@ app.post( '/log', function( req, res ) { } // Decorate the content - var content = req.body; + var content = req.body.text; content = striptags( content, [ 'a', 'code', 'strong', 'em' ] ); content = '<blockquote>' + content + "</blockquote>\n\n#slash-done"; -- GitLab