An unofficial wrapper for the unofficial Microsoft Teams API
This library (still work in progress) was created with the goal
of helping the creation of alternative (and open source)
Microsoft Teams clients. Currently, the library itself can only
handle a couple of endpoints and is by far not ready yet.
My goal is to complete this library as soon as possible and start
the creation of an alternative client based on it.
For now, you can only run the tests or use the library on your own. For this you'll need a couple of Microsoft Teams tokens.
Using teams-token one can obtain (and automatically save)
the tokens necessary for this library to work.
Simply clone and yarn start that repository to get your Teams tokens stored into:
/home/user/.config/fossteams/token-chatsvcagg.jwt
/home/user/.config/fossteams/token-graph.jwt
/home/user/.config/fossteams/token-skype.jwt
/home/user/.config/fossteams/token-teams.jwtWith these tokens, you'll be able to test out some features like the
GetConversations test that retrieves a list of Teams your user is connected with.
This repository can also load an experimental Microsoft Graph token from either:
/home/user/.config/fossteams/token-graph.jwtor:
MS_TEAMS_GRAPH_TOKENThe token is intended for delegated Microsoft Graph calendar access and is
currently used by the pkg/graph client for calendar discovery, time-windowed
event listing, and event CRUD operations.
Example:
graphToken, err := api.GetGraphToken()
if err != nil {
panic(err)
}
calendarClient := graph.NewCalendarClient(http.DefaultClient, graphToken)
calendars, err := calendarClient.ListCalendars()
if err != nil {
panic(err)
}
events, err := calendarClient.ListEvents(graph.ListEventsOptions{
Start: time.Now().UTC(),
End: time.Now().UTC().Add(7 * 24 * time.Hour),
})
if err != nil {
panic(err)
}
fmt.Printf("loaded %d calendars and %d events\n", len(calendars), len(events))This Graph auth path is experimental. The existing teams-token Electron flow was
originally built for Teams-specific audiences, so Microsoft Graph consent or client
compatibility issues may still require a dedicated Graph app registration later.
Write operations such as CreateEvent, UpdateEvent, and DeleteEvent require
the extracted Graph token to carry delegated write scope such as
Calendars.ReadWrite.
I have created a Microsoft Team org with the free version that you can join and test out / help debugging / improve this library with.
This would also be interesting because we can use it as a platform to discuss the API / CLI and it will help us implement more features related to multi-tenancy.