This is demo project for booking meeting room in Office 365 Tenant by Google Assistant (Home).
- How to setup OAuth authentication for Microsoft Graph in Dialog Flow
- How to book meeting room through Microsoft Graph
- Haven't implemented the function to find available room in room list. You can implement it with following 2 APIs.
- Get meeting rooms with findRoomLists API and findRooms API.
- Find available foom with findMeetingTimes API or List events API
- No test.. sorry
- Install Node.js in your development environment. I assume you can understand es6.
- Basic TypeScript knowledge. Please learn from tutorial document
- I assume you have O365 tenant. If you want to try O365, you can try trhough [Free trial] in product page
- In addition to it, I assume you have meeting room as resource mail box in O365 tenant. If you dont't have it, you can make it with this document
For OAuth authentication, need to register app and pickup Client ID
and Client Secret
. In addition to it, need to set redirect url and scope. You can learn how to setup with following section.
- Register(create) new app in the app registration portal with this document. Please save your
Applicaion Id(Client ID)
andPassword(Client Secret)
in the clipboard. - Add platform as
Web
with [Add Platform]button. - Paste
https://oauth-redirect.googleusercontent.com/r/<Your project id>
in the [Redirect URLs]text box. - Add
Calendars.ReadWrite.Shared
andUser.Read
delegated permissions in the [Microsoft Graph Permissions]section. - Save your change.
- Play around to build your first agent and try to use Fulfillment. You will update Webhook url later.
- Please set
reserve.room
as action name. It need to support Fulfillment.
Implementing Account Linking with following parameters.
Property name | Value |
---|---|
Grant type | Authorization code |
Client ID | Application Id generated in app registration portal |
Client secret | Password generated in app registration portal |
Authorization URL | https://login.microsoftonline.com/common/oauth2/v2.0/authorize |
Token URL | https://login.microsoftonline.com/common/oauth2/v2.0/token |
Scopes | https://graph.microsoft.com/Calendars.ReadWrite.Shared https://graph.microsoft.com/User.Read |
Important: You need to turn on [Sign in required] in the [Integration menu] in dialog flow console.
git clone https://github.com/NT-D/RoomFinder.git
npm install
in terminal(or command prompt) for installing node modulesnpm run watch
in another terminal for trans-complie .ts to .js filenpm run start
in terminal for starting app.- Setup ngrok and create forwarding url (ex. You will get the url like https://c349cad0.ngrok.io)
- Set previous url in the Fulfillment settings in dialog flow.
You can get access token through this code in app.ts
.
dialogApp.getUser().accessToken
You can call graph API like this code in msgraphService.ts
.
export async function getUserInfo(accessToken: string): Promise<msGraph.User> {
const response = await fetch(`${apiEndpointUrl}/me`, { method: 'GET', headers: { 'Authorization': `Bearer ${accessToken}` } });
return await response.json() as msGraph.User;
}