@evokegroup/msteams
v1.0.2
Published
Helper for sending message to a Microsoft Teams channel
Downloads
6
Keywords
Readme
@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