Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including winston-office365-connector-hook with all npm packages installed. Try it out:

require("winston/package.json"); // winston is a peer dependency. var winstonOffice365ConnectorHook = require("winston-office365-connector-hook")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

winston-office365-connector-hook v0.1.7

A Winston transport hook to send logs over to a Office 365 Connector, e.g. Microsoft Teams channel.

winston-office365-connector-hook Build Status npm version

A Winston transport hook to send logs over to a Office 365 Connector, e.g. Microsoft Teams channel.

Inspired by winston-slack-hook by fahad19.

Uses queue implementation by jessetane for processing transport tasks.



$ npm install --save winston winston-office365-connector-hook


Note that Office 365 Connector Webhook URL is tied to a given channel, so you don't need to specify a channel name separately.



var winston = require('winston');
var Office365ConnectorHook = require('winston-office365-connector-hook');

var Logger = winston.Logger;
var Console = winston.transports.Console;

var logger = new Logger({
  transports: [
    new Console({}),
    new Office365ConnectorHook({
      hookUrl: '' // No need for a channel name
});'I am being logged here'); // will be sent to both console and Teams channel



  • hookUrl: Connector Webhook URL to post to


  • prependLevel: set to true by default, sets [level] at the beginning of the message
  • appendMeta: set to true by default, sets stringified meta at the end of the message
  • formatter(options): function for transforming the message before posting to Slack
  • colors: use this to set custom colors to log levels. Note that you MUST use hex format, not names. e.g.
  "colors": {
     "debug": "4256f4",
     "error": "f00"

Behind the scenes, the level color is sent as the themeColor property of the card.

generic log error example

Markdown support in messages

Channel messages support Markdown syntax. Any formatting is sent as-is to the Channel.'# Seriously!?\n > This is cool!', { title: 'You can use Markdown in messages.' });

markdown example

Setting card title

You can set a title for the card by sending it as a part of the meta hash:'This text appears in card body.', { title: 'My puny title' });

title example


Messages can be formatted further before posting to the channel:

var logger = new Logger({
  transports: [
    new Office365ConnectorHook({
      hookUrl: ''

      formatter: function (options) {
        var message = options.message; // original message

        // var level = options.level;
        // var meta = options.meta;

        // do something with the message

        return message;


See here

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free