Answer the question
In order to leave comments, you need to log in
Slack webhook & unicode?
How to correctly send a message to a slack webhook like , when sending via curl -X POST -H 'Content-type: application/json' messages arrive, when sent from node I get invalid_payload
function sendMessage(path, text) {
let postData = JSON.stringify ({
'text': text
});
let options = {
hostname: 'hooks.slack.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': postData.length
}
} ;
let req = https.request(options, (response) => {
let str = '';
response.on('data', (chunk) => {
str += chunk;
});
response.on('end', () => {
console.log('Slack send');
console.log(str)
})
});
req.on('error', (e) => {
console.log(`problem with request: ${e.message}`);
});
req.write(postData);
req end();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question