dnac2teams
Overview
dnac2teams is a simple webhook receiver for Cisco DNA Center notifications, forwarding all notifications events to a Microsoft Teams incoming webhook.
DNAC notifications will be displayed as Adaptive Cards in MS Teams:
Installation
Prerequisites
- Add an incoming webhook to a MS Teams team/space (howto)
- If using the preferred AWS/SAM installation method AWS CLI and AWS SAM CLI must be installed
- For the ASW/SAM and Docker installation methods, Docker must be installed
AWS Serverless Application Model (SAM)
dnac2teams is using the AWS Serverless Application Model (Lambda+API-Gateway) and is best installed via SAM CLI.
- You must be logged in to AWS (via AWS CLI)
- You need either full admin permissions or sufficient permissions on the following services:
- Lambda
- API Gateway
- S3
- Cloud Formation
- IAM
- Clone the repo:
git clone https://github.com/spie-ics-ag/dnac2teams.git
- Go to your project folder:
- Edit the
template.yaml
file - Change the global environment variables (line numbers 13/14) for the Teams incoming webhook URL and the authentication token:
TEAMS_URL: https://company.webhook.office.com/webhookb2/webhookid
AUTH_TOKEN: yoursupersecrettoken
- Build the SAM app
sam build --use-container
- Deploy the app
Once deployed the public endpoint URL is displayed in the SAM output, use this URL and the token (specified in point 3) to create the webhook in DNAC.
On-prem installation options
For on-prem installations, there is a simple Flask-RESTX based receiver available.
Clone the repo:
git clone https://github.com/spie-ics-ag/dnac2teams.git
Go to your project folder:
Deploy the app using docker or in a Python3 virtual environment
Docker
- Edit the
Dockerfile
file - Change the environment variables (line numbers 3/4) for the Teams incoming webhook URL and the authentication token:
ENV TEAMS_URL=https://company.webhook.office.com/webhookb2/webhookid
ENV AUTH_TOKEN=yoursupersecrettoken
- Build the container image:
docker build -t dnac2teams .
- Run the container:
docker run --rm -p 5000:5000 dnac2teams
Python
- Create a virtual environment:
- Activate your venv:
source .venv/bin/activate
- Install dependencies:
pip install pip --upgrade
pip install -r requirements.txt
- Configure the webhook URL and the authentication token as environment variables:
export TEAMS_URL=https://company.webhook.office.com/webhookb2/webhookid
export AUTH_TOKEN=yoursupersecrettoken
- Run the app:
cd dnac_to_teams
python flaskapp.py
On-prem webhook endpoint
After starting either the Docker container or Python script, the webhook endpoint is available at http://localhost:5000/prod/dnac2teams. If you need a public endpoint, use ngrok
DNAC Configuration
Configure Destination Webhook
Setup the webhook: DNAC→System→Settings→External Services→Destinations→Webhook
Enter the URL from the SAM output (or the URL pointing to your local instance if you're running the on-prem version), use Token as the authentication method in DNAC, for the header value use the token specified in the AUTH_TOKEN environment variable.
Sandboxes
You may test this app using the following DevNet sandboxes: