Skip to content

Instantly share code, notes, and snippets.

@gmoqa
Created August 7, 2019 16:44
Show Gist options
  • Save gmoqa/c25bc2701738e834e074b4044b854d7d to your computer and use it in GitHub Desktop.
Save gmoqa/c25bc2701738e834e074b4044b854d7d to your computer and use it in GitHub Desktop.
Node.js Mattermost notification no extra packages.
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