Webex Teams Integrations · Talk to Webex Teams via APIs API Cisco Webex Teams REST API GET POST...
Transcript of Webex Teams Integrations · Talk to Webex Teams via APIs API Cisco Webex Teams REST API GET POST...
Presenter: Christina Skoglund, Technical Solutions Specialist, [email protected]: Alvaro Ramos Gutierrez, Technical Solutions Specialist, [email protected] 2020
How to get startedWebex Teams Integrations
© 2020 Cisco and/or its affiliates. All rights reserved. © 2020 Cisco and/or its affiliates. All rights reserved.
Agenda
Ø Introduction
ØPOSTMAN to interact
ØTwo different Bot types
ØAutomate workflows
without coding!
© 2020 Cisco and/or its affiliates. All rights reserved.
What is an API?
© 2020 Cisco and/or its affiliates. All rights reserved.
Application Programming Interface (API)
“It’s a way for two pieces of software to talk to each other”
© 2020 Cisco and/or its affiliates. All rights reserved.
SaaS/Cloud Service
application
REST API
GET
POST
PUT
DELETE
Response JSON …
API
https://developer.cisco.com/learning/devnet-express/dnav4-track/rest-api-fundamentals/what-are-rest-apis/step/1
© 2020 Cisco and/or its affiliates. All rights reserved.
application
REST API
GET
POST
PUT
DELETE
Response JSON
API
Cisco Webex Teams
…
https://developer.cisco.com/learning/devnet-express/dnav4-track/rest-api-fundamentals/what-are-rest-apis/step/1
© 2020 Cisco and/or its affiliates. All rights reserved.
Application interaction with Postman
Great place to start if you are a beginner!!
© 2020 Cisco and/or its affiliates. All rights reserved.
Use Postman to interact with Webex Teams via APIs!
Beginner?
www.postman.com
© 2020 Cisco and/or its affiliates. All rights reserved.
Webex Teams APIs
www.developer.webex.com
© 2020 Cisco and/or its affiliates. All rights reserved.
Talk to Webex Teams via APIs
API
Cisco Webex Teams
REST API
GET
POST
List of rooms
New message
Response JSON …
© 2020 Cisco and/or its affiliates. All rights reserved.
Chat Ops with Webex Teams and Python
Great place to start if you have some
basic Python experience
© 2020 Cisco and/or its affiliates. All rights reserved.
2 Bot use cases
Notification Bots Controller Bots
API
Cisco Webex Teams
© 2020 Cisco and/or its affiliates. All rights reserved.
Controller Bots – “A modern CLI”
API
Bot
Cisco Webex Teams
controller
Give me informationTake specific action…
© 2020 Cisco and/or its affiliates. All rights reserved.
• Two-Way Communication: Systems <-> Chat Rooms • Requires an Internet Accessible Application• DevOps: Request Reports, View Issue Details• SysAdmin: Execute Scripts, Dig Into Alert Data
Controller Bots – “A modern CLI”
© 2020 Cisco and/or its affiliates. All rights reserved.
• Two-Way Communication: Systems <-> Chat Rooms • Requires an Internet Accessible Application• DevOps: Request Reports, View Issue Details• SysAdmin: Execute Scripts, Dig Into Alert Data
Controller Bots – “A modern CLI”
HOW DO I GET THERE?
© 2020 Cisco and/or its affiliates. All rights reserved.
How do I get the intelligence?
© 2020 Cisco and/or its affiliates. All rights reserved.
How do I get the intelligence?
WHAT IS THE MAGIC?
© 2020 Cisco and/or its affiliates. All rights reserved.
Architecture – Let’s break it down with easy example
Cisco Webex Teams
hello
“hello”URL
“Hi there!”
© 2020 Cisco and/or its affiliates. All rights reserved.
The four magic ingredients:
WebhooksPython script
1.
2.
3.
4.
Webex Teams Bot
© 2020 Cisco and/or its affiliates. All rights reserved.
1. Create Webex Teams Bot
Cisco Webex Teams
© 2020 Cisco and/or its affiliates. All rights reserved.
1. Create a Webex Teams BotCreate a bot
www.developer.webex.com and log inMy Webex Apps > Create a New App > Create Bot
>>Save Bot’s token and id<<
© 2020 Cisco and/or its affiliates. All rights reserved.
2. The Bot’s brain
Cisco Webex Teams
hello
Bot’s brain = A Python script
© 2020 Cisco and/or its affiliates. All rights reserved.
2. Python script
• We need our Bot to have a brain
• All logic will be defined in this Python script
• Create a web application with Flask
• Python and Flask are just one example, there are many ways of doing this
• Webex Teams SDK
© 2020 Cisco and/or its affiliates. All rights reserved.
2. Python script
Import Python libraries
Define Flask application
Define the logic of the app
Run Flask application
Import Flask, webexteamssdk
Flask application
The Bot’s brain
Run it!
Structure the Python code!
© 2020 Cisco and/or its affiliates. All rights reserved.
2. Python script
Libraries:• Flask• webexteamssdk
$pip install flask$pip install webexteamssdk
TRY THIS!
© 2020 Cisco and/or its affiliates. All rights reserved.
3. Python Script Needs Internet Access!
Cisco Webex Teams
hello
Bot’s brain = A Python script
URL
© 2020 Cisco and/or its affiliates. All rights reserved.
3. Deploy in Heroku
URL
• Heroku is a PaaS that enables developers to build, run and operate applications in the cloud
• We need a publicly accessible URL!
• Many ways of doing this
• www.heroku.com
© 2020 Cisco and/or its affiliates. All rights reserved.
3. Deploy app in Heroku
© 2020 Cisco and/or its affiliates. All rights reserved.
• Make sure you have a “Procfile”
• Make sure you have gunicorn and heroku installed
3. Deploy app in the Heroku cloud
$pip install gunicorn$pip install heroku
web: gunicorn <scriptname>:app
For YourReference
© 2020 Cisco and/or its affiliates. All rights reserved.
Webex Teams Bot to communicate with brain!
hello
“hello”URL Cisco Webex Teams
© 2020 Cisco and/or its affiliates. All rights reserved.
“A webhook (also called a web callback or HTTP push API) is a way for an app to provide other applications with real-time information”
4. Webhook
© 2020 Cisco and/or its affiliates. All rights reserved.
4. Webhook – how to create it for a bot
Create a webhookwww.developer.webex.com and log inDocumentation > API Reference > Webhooks
© 2020 Cisco and/or its affiliates. All rights reserved.
4. Webhook – how to create it for a bot
© 2020 Cisco and/or its affiliates. All rights reserved.
Bot’s token!
Add your app’s URL
© 2020 Cisco and/or its affiliates. All rights reserved.
Architecture – Let’s break it down
Cisco Webex TeamsWebhook: ‘hello’
1.
2.POST “Hi There!”
URL
© 2020 Cisco and/or its affiliates. All rights reserved.
Architecture
Cisco Webex Teams
How many APs?
Cisco DNA Center
GET:# of AP
Webhook: ‘How many APs?’
POST: “32”
1.
3.
2.URL
© 2020 Cisco and/or its affiliates. All rights reserved.
Architecture
Cisco Webex Teams
How many APs?
Cisco DNA Center
GET:# of AP
Webhook: ‘How many APs?’
POST: ‘32
1.
3.
2.
How many APs?
32
URL
© 2020 Cisco and/or its affiliates. All rights reserved.
Notification Bots
API
Cisco Webex Teams
application
Notification
© 2020 Cisco and/or its affiliates. All rights reserved.
• One-way communication: systems -> chat rooms • Simple architecture: anything that can HTTP POST• DevOps: GitHub, Jenkins, Ant, Maven• SysAdmin: alerts, status, tickets
Notification Bots
© 2020 Cisco and/or its affiliates. All rights reserved.
Notification Bots
Cisco Webex Teams
Cisco DNA Center
WLC reboots
Event triggered in Cisco DNAC
Cisco DNAC notifies Cisco Webex Teams
© 2020 Cisco and/or its affiliates. All rights reserved.
Notification Bots
Cisco Webex Teams
Cisco DNA Center
WLC reboots
Event triggered in Cisco DNAC
Cisco DNAC notifies Cisco Webex Teams
WHAT IS THE MAGIC?
© 2020 Cisco and/or its affiliates. All rights reserved.
WEBHOOKS!
© 2020 Cisco and/or its affiliates. All rights reserved.
Subscribe to events in DNAC
2 Subscribe
Go to Events and choose event1
© 2020 Cisco and/or its affiliates. All rights reserved.
Subscribe to events in DNAC
2 Subscribe
Go to Events and choose event1
URL
© 2020 Cisco and/or its affiliates. All rights reserved.
Notification Bots
Cisco Webex Teams
Cisco DNA Center
WLC reboots
2. Event triggered in Cisco DNAC
Cisco DNAC notifies Python application
3. WebhookPOST
1. Event4.
URL
© 2020 Cisco and/or its affiliates. All rights reserved.
Easy way to automate your integrations…
Integration Platform as a Service (iPaaS)
© 2020 Cisco and/or its affiliates. All rights reserved.
Integration Platform as a Service (iPaaS)
© 2020 Cisco and/or its affiliates. All rights reserved.
Example – integrate two applications
New folder added Create new message
© 2020 Cisco and/or its affiliates. All rights reserved.
Automate workflows without any code!
© 2020 Cisco and/or its affiliates. All rights reserved.
Automate workflows without any code!
Bot’s RoomID
© 2020 Cisco and/or its affiliates. All rights reserved.
What have we talked about?
- Get started with Postman and APIs
- Create your own Controller Bot
- Create your own notification Bot
- Automate integration between Applications
© 2020 Cisco and/or its affiliates. All rights reserved.
• www.developer.cisco.com
• Setup your developing environment:https://developer.cisco.com/learning/devnet-express/devnet-express-cloud-collab-it-pro/devnet-express-event-setup-itp/collab-dne-event-setup-itp/step/1
• Python Programming Basics for Cloud Collab IT Pros (lab):https://developer.cisco.com/learning/modules/devnet-express-python-programming-basics-ccitp/collab-tools-intro-to-git-itp/step/1
• Flask web application Documentation:https://flask.palletsprojects.com/en/1.1.x/
• Heroku:www.heroku.com
• Webex Teams Python SDK Documentation:https://webexteamssdk.readthedocs.io/en/latest/
• Bot Hosting Services:
www.Gupshup.io , www.Zenbot.org
• Google Dialogflow:www.dialogflow.com
Resources – where to learn more!
© 2020 Cisco and/or its affiliates. All rights reserved.
Q&A
54
© 2020 Cisco and/or its affiliates. All rights reserved.
UP-TO-SPEED Cisco WirelessC9800 Wireless controllerne, Wi Fi 6 + designs Afholdes Torsdag den 16. april fra kl. 10 – 11