Skip to content

Added live Teams events, typing indicators and online status - #48

Merged
PianoNic merged 4 commits into
mainfrom
feature/teams-live
Nov 4, 2026
Merged

PianoNic merged 4 commits into
mainfrom
feature/teams-live

Conversation

@PianoNic

@PianoNic PianoNic commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Adds a live feed of Teams events, typing indicators in both directions, and live online status. It uses Trouter, Teams' own push connection, so it's undocumented and can change without notice. Nothing changes unless you call these methods.

What's new

  • note.listen(presence=[user_id]): yields typing, stop_typing, message, message_updated, message_deleted, presence, connected and other events. It reconnects by itself and yields connected each time, so apps can catch up on what they missed.
  • note.send_typing(chat_id) and note.clear_typing(chat_id): show or stop your typing indicator.
  • docs/live.md: usage, events and limits.
  • wreq is now a direct dependency, for the WebSocket.

Testing

Run on real accounts, between two people in a 1:1 chat:

  • Seeing typing: 23 typing events from the other person, about every 4 seconds.
  • Showing typing: the other person reported seeing it, while the user confirmed they weren't typing in Teams.
  • Messages: 18 from them and 10 from the user arrived live, plus 2 edits. A self-chat test measured 318 ms.
  • Presence: a listener reports everyone's current status straight away, and an update for the signed-in user arrived live.
  • Stopping and failures: it stopped cleanly, and it reconnected with backoff when connections were refused.

The tests pass, and Ruff and mypy are clean. The live tests ran before this branch was updated with main, and the docs and one docstring were added after them.

Known limits

  • Typing events had no sender name, only an id.
  • stop_typing never arrived in testing, so apps should time out the indicator themselves. It's only covered by unit tests.
  • Another person's status change hasn't been seen live, and someone typing in the chat stayed reported as Offline.
  • message_deleted is only covered by unit tests.
  • Anything sent while disconnected is missed.
  • Tokens renewing on a long-running connection, and connections lasting more than a few minutes, haven't been tested live.
  • Only tested on one tenant.

@PianoNic PianoNic added the enhancement New feature or request label Nov 4, 2026
@PianoNic
PianoNic merged commit a5d2fb7 into main Nov 4, 2026
3 checks passed
@PianoNic
PianoNic deleted the feature/teams-live branch November 6, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant