Next click on Add a permission – then select Office 365 Management APIs
– and choose Delegated permission on the next pane – and I’m only interested in Service Health (which includes Message Center) so have selected just that one option and clicked Add permission.
The final permission step is to Grant admin consent – so it should look like this:
Next we need a key for our application so that our connector can prove who it is. Certificates and Keys can be found in the left navigation with your API registration selected. Clicking New client secret creates the key. I chose 2 years for expiry. Copy it from here as it won’t give you a second chance.
We should be good to go now – so we can proceed with our connector.
Go to https://flow,microsoft.com and then to Data in the left navigation and Custom Connectors. Click Create custom connector to get started. I’m creating from Blank – if you know what Postman and OpenAPI are then feel free to take another approach. I used Postman and there are some good explanation articles around but none specific to these APIs. Give your connector a name – mine is O365 Message Center Connector and then click continue. The 1st page of 4 then appears – General information
The important pieces here are the Host - manage.office.com and the Base URL - /api/v1.0/contoso.com/ServiceComms/Messages. Feel free to add an icon, colour and description – then click forward to Security, and select OAuth 2.0 from the initial option – then Azure Active Directory from the drop down at the top of the OAuth 2.0 form.
I’ve filled in the Resource URL – https://manage.office.com , and the other fields can be set with the data from your App registration.
Client ID is the Application (Client) ID. Client secret is the key you generated. The rest leave as is, and advance to Definition. For now we will just enter the General information and the Request, by selecting import from sample and then just selecting GET and entering a URL.
The full URL is of the form - https://manage.office.com/api/v1.0/<your domain here>/ServiceComms/Messages/api/v1.0/<your tena...
The request is easiest defined by using the json of a returned request as a sample – and if you scroll to the end I have added a sample json you could use. Just clich add default response – paste in the json and click import.
To see what this did – you can click the ‘default’ button and it will show what it stripped out of the response. This was a Message Center Response but this could also be used for Incidents. There are things you can do on this page like hide some of these – or make them ‘important’ (they show up first) – but just for playing around you can leave it at that point.
We are nearly there – but we also need to enter the Reply URl back in our App permissions – this was added as the Redirect URL on the 2. Security page once we saved that page. Click the page icon to the right of the URL to copy.
Once you have it – back to your App Registration and add a redirect Url – then save
OK, now for the exciting part – Create and Test! Back to your CustomConnector and click Create connector up at the top right and then click Test – the 4th stage. We first need to add a connection – so click the + New connection
This will prompt you to log in – then you have a new active option – Test operation – so go ahead and click it and see what happens? Hopefully OK (200)
So that is working! Next we can try it in a Flow, and I’m keeping it simple with a schedule to start things off – and run once a day – then this schedule triggers my next thing – which is my custom connector (find it under custom). I then have an Apply to each – automatic as it detects there will be multiple ‘values’ (Items). To keep things simple I’m just interested in Project Online items – so I filter Title for ‘Project’ – and then I create a new task in an existing Plan – and add the ID to the Title – then update the Task Details with the actual message. I added the dates for good measure. I wasn't intending this as a Flow tutorial – but hopefully you can follow from this screenshot.
After this Flow runs I have two new Tasks – and Task details too!
To get the same features as my Azure Functions example you’d have to have a much more complex Flow – updating Tasks that already exist – copying in the External Links too – but making sure they were not NULL (@empty is your friend) – as well as adding different assignees based on the Task Title and putting in a differen tbucket. All perfectly possible – but beyond the scope of this posting which was really about getting connected to the Message Center. Enjoy!
And this is the json to copy in for the response sample.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.