Created
August 7, 2019 16:44
-
-
Save gmoqa/c25bc2701738e834e074b4044b854d7d to your computer and use it in GitHub Desktop.
Node.js Mattermost notification no extra packages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https') | |
const data = JSON.stringify({ | |
username: 'App logger', | |
icon_url: 'https://www.mattermost.org/wp-content/uploads/2016/04/icon.png', | |
text: 'Hello Mattermost' | |
}) | |
const options = { | |
hostname: 'your_mattermost.server', | |
path: '/hooks/334ktjodu7gq5yq7afj3wabdre', | |
method: 'POST' | |
} | |
const req = https.request(options, (res) => { | |
res.on('data', (d) => { | |
console.log('Sended') | |
}) | |
}) | |
req.on('error', (e) => { | |
console.log(e) | |
}) | |
req.write(data) | |
req.end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment