I am writing a Teams-Slack integration. The point is to get our Shifts defined in MS Teams and change the descriptions of certain Slack channels according to who is on Shift.
In any case, the Slack end is all done, but I'm having a lot of issues with Teams and their API.
First of all, this is my main resource: https://learn.microsoft.com/en-us/graph/api/schedule-list-shifts?view=graph-rest-beta
Okay so here's what I've already done.
- I have registered my bot in Azure and I have an ID
- I have given the bot the required permissions
- I have found the Teams group ID for our shifts
And this is how the process is done by hand:
Navigate to a URL which will give me my code. I've attached a picture instead of a big URL jumble

When I navigate to this URL (not using Python), I reach a page which makes me confirm my O365 User. (When Python tries this, it asks for a complete Log-In)

- I then get redirected to the localhost page with a parameter code=SOMECODEHERE
- I then get this code and send it in a POST request using Postman in order to get my access token:
- I then use this bearer access token to pull the shifts.
Here are my issues/questions:
- When I eventually get my JSON file with all the team members' shifts, it only shows shifts for 1 month back and before. Aka today is 22-04-2019 and the last shift I can see is 22-03-2019.
- The JSON also doesn't show who is on-shift or On-call. I mean, I can see that there IS a shift on say 20-02-2019, but it doesn't return any UIDs or Names for the members who are on that shift. Is there any way to find this?
- Is there any way to get the "code=" value with python? It asks it to log in (as it asks me to confirm my O365 user - see 2nd image). Do I really need to hardcode my own login details so a bot can navigate to a page? That is dumb imo. I know I can read the redirected URL but I can't even get there.
