Oracle Notification Service (ONS) is a robust cloud-native tool that allows you to route notifications from Oracle Topics to various destinations like email, Slack channels, custom HTTP webhooks or OCI Functions with ease. Support of OCI Functions as Notification target allows to invoke custom function during Notification event and send updated notification details to communication channels that support API invocation. In this article, I'm going to show the integration between OCI and Microsoft Teams, ensuring that critical OCI events are communicated effectively to your team.
- Resources in Oracle Cloud Infrastructure (OCI) emit events, which are structured messages indicating the state of change of resources throughout the tenancy. For example, an event can be emitted when an instance starts, a backup completes or fails, or a file in an Object Storage bucket is added, updated, or deleted.
- OCI Notifications route these events to the appropriate destinations.
- OCI Functions reformat the event data (JSON Payload) to the Adaptive Card format required by Microsoft Teams.
- The restructured message is then published to Microsoft Teams via a webhook, ensuring that the notification is displayed correctly in the Teams channel.
To receive notifications from OCI in Microsoft Teams, set up a workflow in Microsoft Teams to handle incoming webhook requests and post to a channel or chat. Follow the steps in the Microsoft Teams Incoming Webhook Documentation to create an incoming webhook.
The function code is provided in the sample code folder with the following files:
func.py
: Main function file, which processes incoming OCI event data and formats it for Microsoft Teams.requirements.txt
: Lists the dependencies needed to run the function.func.yaml
: Metadata file containing configuration details for deploying the function in OCI.
Ensure these files are available and accessible for deployment.
The detailed, step-by-step setup guide can be found in the setup.md file. It includes instructions to:
- Create a dynamic group and policy to grant necessary permissions.
- Create a repository and deploy the function in OCI.
- Set up OCI Notifications and subscribe to a topic.
- Test and validate the function by triggering OCI events.
After deployment, any specified OCI events (e.g., instance stopped or Object Storage file upload) will trigger the notification function, which sends a message to the configured Microsoft Teams channel. You can update the function to customize the message format or to include additional event details.
To test the integration, you can trigger an event by stopping or starting an instance, or by creating a file in Object Storage (if these events are configured as triggers). Verify that the notification appears in the designated Teams channel.
Here are some common issues and tips to help resolve them:
- Webhook Delivery Issues: Verify that the webhook URL in the function code matches the Microsoft Teams webhook URL.
- Permission Denied Errors: Ensure that the IAM policies and dynamic group settings are correctly configured for the function.
- Function Deployment Errors: Check the
func.yaml
file for accurate configuration, and verify that all required dependencies are listed inrequirements.txt
.
- Oracle Cloud Infrastructure Notification Service
- Oracle Cloud Infrastructure Events
- Oracle Functions
- Microsoft Connectors
This project is licensed under the MIT License - see the LICENSE file for details.
This setup enables seamless integration between OCI and Microsoft Teams, ensuring that critical OCI events are effectively communicated in real time to your team, improving visibility and operational efficiency.