TeamsGPT lets you connect your Microsoft account to ChatGPT, allowing it to reply to your Teams DMs!
This is highly configurable and lets you enter userIDs to reply to, whilst it ignores all the others
Using the MS Graph API, it retrieves user messages, then filters the unread ones by user ID (specified in config)
If it matches a "target", then it sends it to the ChatGPT API, with past conversation context, and then generates+sends a response
Relies on Python 3.9+
Install the required dependencies via:
pip3 install -r ./requirements.txt
NOTE: Currently this only works with enterprise or educational Microsoft Accounts as personal ones do not offer the APIs used
- Create an OpenAI account and get an API Key here
- Register a new app here
- Add a redirect URI with platform set to
Web
and URI set tohttp://localhost:5000/loggedIn
- Under the
Certificates & Secrets
section, create a new client secret - Create a
secrets.json
file with the following contents:
{
"AI.api_key": "[API Key from OpenAI]",
"MS.client_id": "[MS Application ID]",
"MS.client_secret": "[MS Client Secret]",
"MS.tenant": "[MS Tenant ID]"
}
- Run
sign-in.py
and click on the link shown in the terminal and follow the instructions, once you seeYou are now signed in! (You can stop running the program now)
quit the program - Run
listChats.py
Create a config.json
file with the following contents:
{
"targetUserIDs": []
}
- Add the target UserIDs from the members lists supplied by
listChats.py
- Run
main.py
- Enjoy!