Michael, one of the Matchbox developers, had an idea for a personal project to improve the office tools and productivity. Here is his journey from start to finish.
What I did:
As soon as I began investigating Slackbot integrations, I had the idea of a Slackbot that could announce upcoming Office 365 calendar appointments. The nature of it seemed like a natural fit to a bot, and the advantages it would have over other notification methods is that it would be controllable, and customisable.
I started by investigating a method of integrating with Office 365; in particular, their REST based HTTP API. It seemed easy to use, and would be ideal for a bot integration to query. That whole idea soon fell flat, as we discovered that the API was immature. The problem was that it was incapable of accessing any data other than your own.
At the time, another internal project was facing a similar dilemma. The Amazon Echo/Alexa Meeting Room Assistant project also needed calendar appointments. With some investigation and collaboration, we found a solution. We produced a .NET based API which used Outlook EWS services to query shared calendars. While the calendar needing to be shared wasn’t ideal, it suited the Alexa project and would just have to be a technical constraint for the Slackbot.
The next step was writing the Slackbot. I accomplished this with node.js due to the existence of easy to use Slackbot node modules. Interfacing with our Outlook EWS bridge API with a single HTTP method was easy.
How it works:
We ended up with two parts. The Outlook EWS bridge hosted on Azure, and the node.js slack bot running in an Azure virtual machine.
The bot itself uses the Slack real time messaging API to receive all Slack messages. It then checks these messages for ‘meetings *’ and performs the appropriate command. The most significant one being a register command to associate the Slack user to the email address of the calendar they wish to monitor.
As mentioned before, for that to work, their calendar is shared with the email address that the Outlook bridge uses.
The node.js bot polls the bridge API every minute or two and obtains all calendar appointments for each user due in the following 15 minutes.
Using the information of the appointment, the bot sends a message formatted for readability as a direct message. This message contains the appointment subject, location, start and end date/time, organiser, and attendees.
One of the original stretch goals, and still a desirable addition is to send a direct message to all attendees of the appointment in a group chat.
Since it’s deployment one of the requested features is to be able to query your next appointment.
Another desirable addition would be to include a link to the appointment in Office 365.
If the Office 365 Outlook REST API matures enough to cover the functionality the bot needs, it would be much more preferable. This means we could cut out the intermediate server that dictates which information is available.