@reuters-graphics/teams-klaxon
Send messages to a Microsoft Teams channel.
Quickstart
Setup a Microsoft Teams incoming webhook in a channel, then install the library.
$ yarn add @reuters-graphics/teams-klaxon
const TeamsKlaxon = require('@reuters-graphics/teams-klaxon');
const webhook = 'https://outlook.office.com/webhook/...';
const klaxon = new TeamsKlaxon(webhook);
await klaxon.log({
text: 'A simple message',
});
Message formats
Text
await klaxon.log({
text: 'A simple message',
});
Facts
await klaxon.log({
title: '⚙️ Testing facts',
facts: {
Name: 'Jon McClure',
Age: '35',
},
});
Images
await klaxon.log({
title: '⚙️ Testing images',
images: [
'https://scitechdaily.com/images/Great-White-Shark-Smile-1536x1152.jpg',
'https://cdn.britannica.com/79/65379-050-5CF52BAC/Shortfin-mako-shark-seas.jpg',
],
});
Stack trace
await klaxon.log({
title: '⚙️ Testing stack trace',
stackTrace: {
title: 'Stack trace',
code: 'console.log(\'hello world\'!)',
},
});
Link buttons
await klaxon.log({
title: '⚙️ Testing link buttons',
linkButtons: [{
name: 'Google',
link: 'https://www.google.com',
}, {
name: 'Twitter',
link: 'https://www.twitter.com',
}],
});
Color
await klaxon.log({
title: '⚙️ Testing color',
color: 'FF0000'
});
Multiple options
await klaxon.log({
title: '⚙️ Testing multiple options',
color: 'FF0000',
facts: {
Name: 'Jon McClure',
Age: '35',
},
images: [
'https://scitechdaily.com/images/Great-White-Shark-Smile-1536x1152.jpg',
'https://cdn.britannica.com/79/65379-050-5CF52BAC/Shortfin-mako-shark-seas.jpg',
],
stackTrace: {
code: 'console.log(\'hello world!\')',
},
linkButtons: [{
name: 'Google',
link: 'https://www.google.com',
}, {
name: 'Twitter',
link: 'https://www.twitter.com',
}],
});
Testing
$ yarn test