1.0.2 • Published 4 years ago
@evokegroup/msteams
Helper for sending message to a Microsoft Teams channel
Class: MSTeams
constructor(url)
Parameter | Type | Default | Description |
---|
url | string | | The channel's webhook URL |
Methods
sendCard(card)
Parameter | Type | Default | Description |
---|
card | MSTeams.Card | | The card to send |
Usage
const MSTeams = require('@evokegroup/msteams');
const card = new MSTeams.Card({
title: 'Title',
text: 'Message text'
});
const msTeams = new MSTeams('https://outlook.office.com/webhook');
msTeams.sendCard(card)
.then(() => {
// Card sent
})
.catch((ex) => {
console.log(ex);
});
sendMessage(object)
Parameter | Type | Default | Description |
---|
title | string | | The card title |
text | string | | The card text |
Usage
const MSTeams = require('@evokegroup/msteams');
const msTeams = new MSTeams('https://outlook.office.com/webhook');
msTeams.sendMessage({
title: 'Title',
text: 'Message text'
})
.then(() => {
// Card sent
})
.catch((ex) => {
console.log(ex);
});
Static Methods
send(object)
Parameter | Type | Default | Description |
---|
url | string | | The channel's webhook URL |
card | MSTeams.Card | | The card to send |
title | string | | The card title if card is undefined |
text | string | | The card text if card is undefined |
Usage
const MSTeams = require('@evokegroup/msteams');
MSTeams.send({
url: 'https://outlook.office.com/webhook',
title: 'Title',
text: 'Message text'
});
Class: MSTeams.Card
constructor(object)
Parameter | Type | Default | Description |
---|
title | string | | The card title |
text | string | | The card text |
Properties
Property | Type | Description |
---|
title | string | The card title |
text | string | The card text |
Methods
serialize()
Serializes the card