This is the first iteration of the Notifications API. In this iteration, the API will handle a single API call to:
-
Create an app.
-
Place it in the appropriate Teams channel.
-
Set up a card in the Teams channel with two buttons:
- One for reprocessing (dummy functionality).
- One to view a file.
-
Retrieve the file from a blob storage location.
-
Display the file in Teams when the button is clicked.
Local setup will use the debug bot to communicate making it possible to locally debug.
We run the rest of the application in Azure AKS with WorkLoad identities, these are created with azwi and their clientId's are stored in a Service account, we use the service acount in the pod to authenticate, more information can be found here: https://learn.microsoft.com/en-us/azure/aks/workload-identity-overview
Since this uses federation we cannot use it locally, for this we will use a bot service setup with a client secret, we also have to have an api endpoint, to make it work locally:
-
Create a dev tunnel:
devtunnel user login # only once every 24h or so devtunnel host -p 3978 --allow-anonymous -
On the Azure Bot (for local/debug: devops-debug-bot), select Settings, then Configuration, and update the Messaging endpoint to
{tunnel-url}/api/messageseg:https://kw238403-3978.eun1.devtunnels.ms/platform-teams-notification-api/api/messages -
Change the secret of the appsettings.local, you can create this by hand, the client-id and tenant is already setup but might need to be changed if this is a new application
-
Run the application
-
Add the bot to teams, select Settings, then Channels, and click on the link Open in Teams or let the bot install it for you
devops-azure will create the bot services automatically, but to be able to use the app you have to go to:
https://dev.teams.microsoft.com/apps and create a new app, use the templates from src\Teams.Notifications.Api\appManifest\ENV
You will have to change the following:
- Manifest.id (take that from the manifest that is created when you create the app)
- The bots.botId/webApplicationInfo.id and resource, leave the
api://botid-part for the resource, just do a guid replace, the ID should be the AppId of the app, this is equal to theMicrosoft App IDin theConfigurationof your bot that is underBot servicesInitialize-PlatformTeamsNotificationApi.ps1will auto create the right permissions, this is needed to install the bot, read messages that are not sent to the bot etc
- You might want to change the names, logo's etc, we use Uniphar since that is what we use it for
The pending apps you can find in https://admin.teams.microsoft.com/policies/manage-apps with pim you can approve these, to view, choose app type= custom app or search for the name, it will take a few hours to propagate, if you open teams in the browser it tends to be there quicker.
https://api.dev.uniphar.ie/platform-teams-notification-api/swagger for the swagger page (change dev to the right env)
If you move the pre-commit file from the root, to .git/hooks/pre-commit it will automatically format your Adaptive card templates, otherwise you will either have to run the task Run formatter in vscode or the build will fail!