Skip to main content

teams-monitor

ci pypi python version platform License

A lightweight Windows background tool that tails the Microsoft Teams log and sends webhook alerts for incoming calls, missed calls, new activity, and Teams outages.

Use it to get Teams alerts on your phone or in another chat tool when you're away from your desk. It only reads the local log, so it needs no credentials or admin consent.

Features

  • Call Alerts - Get notified when a call starts ringing and when it ends unanswered
  • Activity Alerts - Get notified when the taskbar unread count rises (see Limitations)
  • Outage Detection - Catch Teams exits, crashes, and hangs using the tray icon, the process list, and log activity
  • Webhook Delivery - Send JSON that works with Slack-style and Discord incoming webhooks, with automatic retries
  • Read-Only Monitoring - Never writes to the Teams log, and only holds it open while reading
  • No Dependencies - Uses only the Python standard library, with no admin rights or compiled executable needed

Requirements

  • Windows
  • Python 3.11 or later
  • The new Microsoft Teams client (ms-teams.exe)

Installation

Commands in this README are for PowerShell.

From PyPI

pip install teams-monitor

To upgrade later, run pip install --upgrade teams-monitor, then restart the monitor.

From Source

Clone the repository to run it locally or edit the code:

git clone https://github.com/JacobArthurs/teams-monitor.git
cd teams-monitor
pip install -e .

The -e flag means your code changes apply without reinstalling. To upgrade later, run git pull, then restart the monitor.

Quick Start

Create your config file. If you installed from PyPI, create a settings folder and download the example config into it:

mkdir $env:USERPROFILE\teams-monitor-config
cd $env:USERPROFILE\teams-monitor-config
Invoke-WebRequest https://raw.githubusercontent.com/JacobArthurs/teams-monitor/main/config.example.toml -OutFile config.toml -UseBasicParsing

If you cloned the repository, copy the example config from inside the repository folder instead. Your copy is gitignored:

copy config.example.toml config.toml

Edit config.toml to set [webhook] url, then start the monitor from the folder that holds it:

python -m teams_monitor

Stop it with Ctrl+C.

To try it without sending anything, leave url empty. It then runs in dry-run mode and only logs alerts. Set from_start = true under [debug] to replay the current log file while testing. The output looks like this:

2026-11-05 11:44:26,087 WARNING teams_monitor.bootstrap: no webhook configured, running in dry-run mode (alerts are only logged)
2026-11-05 11:44:26,088 INFO teams_monitor.monitor: monitor started
2026-11-05 11:44:26,088 INFO teams_monitor.tailing.tailer: tailing MSTeams_sample.log from offset 0
2026-11-05 11:44:26,093 INFO teams_monitor.notifiers.log_notifier: ALERT incoming_call p1: Incoming call
2026-11-05 11:44:26,093 INFO teams_monitor.notifiers.log_notifier: ALERT missed_call p2: Missed call

Usage

python -m teams_monitor [--config PATH]

The monitor runs until it is stopped. teams-monitor also works if Python's Scripts folder is on your PATH, so python -m teams_monitor is more reliable.

Flag Description
--config Path to the config file (default: config.toml in the current folder)
--version Print the version and exit
-h, --help Show help and exit

Alerts

Priority 1 is the most urgent.

Alert Priority Fires when
Incoming call 1 A call starts ringing
Missed call 2 A ringing call ends without being answered
New activity 3 The taskbar unread count rises and is still up 2 seconds later
Teams down 4 The tray icon is removed and not re-added within 5 seconds, ms-teams.exe isn't running, or the log has no line in the expected format for stale_minutes

Teams down fires once per outage. No alert is sent when Teams recovers, so a later outage is the next thing you'd hear about.

Limitations

These come from what Teams writes to its log:

  • Missed, declined, and caller-cancelled calls look identical.
  • New activity alerts have no sender, content, or type, only the unread count. They depend on a DBG level line in the Teams log. See Troubleshooting to check whether your log has it.
  • A rise in the unread count soon after a missed call is suppressed (3 seconds by default). That default is based on limited testing.
  • After a restart, the first unread count sets a new baseline, so activity that arrived while Teams was closed doesn't alert.
  • A change to the overall log line format is detected: a warning is logged after 100 unrecognized lines in a row, and a Teams down alert follows after stale_minutes. A change to the wording of a single message isn't detected, because it looks the same as the event never happening.
  • Signals were validated on commercial tenant logs only. GCC High (US government tenant) logs had no calls or unread items, so call and activity alerts are unconfirmed there.

Configuration

Settings live in config.toml. The file must exist, but every setting in it is optional. config.example.toml documents each one. Unknown sections and keys are rejected, so a typo fails at startup instead of being ignored.

Section Key Default Description
[teams] log_dir See below Folder containing the MSTeams_*.log files
[teams] process ms-teams.exe Process checked for outage detection. Empty disables the check.
[webhook] url empty http or https address for alerts. Empty means dry run.
[monitoring] poll_seconds 0.5 How often the log is polled for new lines
[monitoring] check_interval_seconds 30 How often the outage check runs
[monitoring] stale_minutes 10 Alert after this long with no line in the expected format
[monitoring] active_hours empty Local time window for Teams down alerts. Empty means always. See below.
[monitoring] suppress_after_missed_seconds 3 Ignore an unread count rise this soon after a missed call
[logging] file empty Write monitor logs to this rotating file. Empty prints to the console.
[logging] verbose false Enable debug logging
[debug] from_start false Read the current log file from the beginning

The default log_dir is:

%LOCALAPPDATA%\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Logs

active_hours looks like 08:00-18:00. Start and end must differ, and the window can wrap past midnight, such as 22:00-06:00. If Teams is still down when the window opens, the alert fires then. It only affects Teams down alerts, so call and activity alerts are sent at any hour.

poll_seconds, check_interval_seconds, stale_minutes, and suppress_after_missed_seconds must be finite and no greater than 1,000,000. All must be above 0, except suppress_after_missed_seconds, which can be 0.

Webhook Delivery

Payload

Alerts are sent as JSON. Slack-style webhooks read text, and Discord reads content:

{
  "alert": "incoming_call",
  "priority": 1,
  "text": "[Teams] Incoming call",
  "content": "[Teams] Incoming call",
  "host": "MY-PC",
  "sent_at": "2026-10-13T13:41:20-04:00",
  "call_id": "13e25d06-3814-4a7f-afbd-109d3c013a6a",
  "log_ts": "2026-10-13T13:41:20.566372-04:00"
}

Each alert type adds its own fields:

Alert Additional fields
incoming_call, missed_call call_id, log_ts
new_message (New activity) unread, presence, log_ts
teams_down reason

The reason field on teams_down tells you what triggered the alert:

Reason Meaning
tray icon removed Teams removed its tray icon and didn't add it back within 5 seconds
Teams process is not running The process set in [teams] process wasn't found
no log activity for N min The log has had no new lines, which can mean Teams has hung
log lines not recognized for N min (the log format may have changed) The log is being written, but its lines no longer match the expected format

Retries and Failures

Response Behavior
Network error, malformed response, 5xx, 429 Retried after 1, 2, and 4 seconds. A Retry-After header can lengthen a wait, up to 30 seconds.
Other 4xx Fails without retrying
Redirect (3xx) Fails without retrying, because following one would lose the alert body. Set url to the final address.

Each attempt times out after 5 seconds.

Call alerts have their own delivery thread, so they never wait behind activity or outage alerts. On a dead endpoint, one alert can still take up to 27 seconds to give up, and a second call alert would wait behind the first.

At shutdown, queued alerts get up to 15 seconds to send. Any that don't are named in the log.

Troubleshooting

Problem What to check
config file not found Run the monitor from the folder that holds config.toml, or pass --config
Teams log folder not found Set [teams] log_dir to the folder containing the MSTeams_*.log files
No activity alerts Check that your log contains unread count lines, using the command below
delivery of ... failed: HTTP 4xx Check [webhook] url. The endpoint rejected the alert, so it isn't retried.
The webhook URL redirects Set [webhook] url to the final address
Nothing happens at logon Check %LOCALAPPDATA%\teams-monitor\startup-error.log and your [logging] file

To check for unread count lines, run this after a new message arrives in Teams. If it prints nothing, activity alerts can't fire on your machine:

Select-String -Path "$env:LOCALAPPDATA\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Logs\MSTeams_*.log" -Pattern "TaskbarBadgeServiceLegacy" -List

Contributing

Contributions are welcome! To get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b my-new-feature)
  3. Open a pull request

CI will automatically run tests and linting on your PR.

License

This project is licensed under the MIT License.

Metadata

Release files for teams-monitor 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teams-monitor 0.1.0
File Size Uploaded Provenance Actions
teams_monitor-0.1.0.tar.gz 53.6 kB With provenance Details for teams_monitor-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for teams-monitor 0.1.0
File Interpreter ABI Platform Actions
teams_monitor-0.1.0-py3-none-any.whl Python 3 none any Details for teams_monitor-0.1.0-py3-none-any.whl

Total release size: 94.2 kB

Release files / teams_monitor-0.1.0.tar.gz

Download URL teams_monitor-0.1.0.tar.gz
Size 53.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4d710d7e7aa8ef04544da8769158a29435c7a636fc2c4e83c38ce64b678f8186
BLAKE2b-256 checksum
How to use checksums
a6038f80dbe064826277febc65b4c49137921e33085e72405ad644fd84f26055
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / teams_monitor-0.1.0-py3-none-any.whl

Download URL teams_monitor-0.1.0-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71172f95a7890b067a46c8c43b4fe4019b87c982b76223966ddc05e80bb91d52
BLAKE2b-256 checksum
How to use checksums
81c5d918e59b7e5d708508e7e001c8c26d300003590642c0ba8ec854b458e939
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for teams-monitor 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for teams_monitor-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page