《Webex 呼叫的敏捷管理 -具備API.pdf》由會員分享,可在線閱讀,更多相關《Webex 呼叫的敏捷管理 -具備API.pdf(73頁珍藏版)》請在三個皮匠報告上搜索。
1、#CiscoLive#CiscoLiveJohannes Krohn,Principal Technical Marketing EngineerBRKCOL-3015Theres an API for thatAgile Management of Webex Calling 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveEnter your personal notes hereCisco Webex App Questions?Use Cisco Webex App to chat w
2、ith the speaker after the sessionFind this session in the Cisco Live Mobile AppClick“Join the Discussion”Install the Webex App or go directly to the Webex spaceEnter messages/questions in the Webex spaceHowWebex spaces will be moderated by the speaker until June 9,2023.12343https:/ 2023 Cisco and/or
3、 its affiliates.All rights reserved.Cisco PublicBRKCOL-30153Agenda 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicWhy APIs?Coverage/CapabilitiesGetting startedUse cases/ExamplesClosingBRKCOL-30154Why APIs?2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveAP
4、I,What,Where,and Why?Definition:.is a set of subroutine definitionssubroutine definitions,protocolsprotocols,and toolstools for building application software.In general terms,it is a set of clearly defined clearly defined methods of communicationmethods of communication between various software comp
5、onents.Documentation for the API is usually provided to facilitate usage.”1APIsEnabler for open systems integrationUniversally availableUnleash developer innovation1WikipediaBRKCOL-30156 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex Calling Provisioning MethodsCont
6、rol HubControl HubCSVAPIAPIEase of UseSpeedCustomizationBRKCOL-30157Coverage/Capabilities 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex APIsDocumentation:http:/Various APIs available:Admin(licenses,locations,memberships,people,.)Calling(call control,locations,peopl
7、e,org/location settings,)Devices(configuration,places,workspace locations,xAPI,)Meetings(invitees,participants,preferences,)OAuth access token used for authorizationBRKCOL-30159 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex Calling API capabilitiesProvisioningUsers
8、(incl.calling entitlements),locations(r/o),call pickups,call queues,hunt groups,auto attendant,call parks,schedules,voice messaging settings,person settings:barge,call forwarding,call intercept,call recording,caller ID,voicemail settings,Coverage continuously growing*Call ControlDial,answer,reject,h
9、angup,hold/resume,divert,transfer,park/retrieve,start/stop/pause/resume recording,DTMF,push,pickup,bargeWebhook Notifications/EventsVoice messagesCall events*Check https:/ and https:/ updatesReferences:https:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex Calling P
10、rovisioning APIsLocations,https:/ locationsGet location detailsCreate/Update locationsDelete:not possiblePeople,https:/ parameter to access calling data*Note:US TNs use 10D format instead of+E.164BRKCOL-301511 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex Calling P
11、rovisioning APIsOrganization Settings,https:/ features found in Feature tab in Control HubPerson Settings,https:/ found in persons Calling tab in Control HubBRKCOL-301512 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex Calling Voice Messaging APIsVoice Messaging,http
12、s:/ voicemail and MWIUser access only;no admin accessMessage summary,list messages,delete message,mark read/unreadBRKCOL-301513 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex Calling Call ControlsActionsDial,answer,reject,hangup,hold/resume,divert,transfer,park/retr
13、ieve,start/stop/pause/resume recording,DTMF,push,pickup,bargeManagementList,get details,call historyList/Details use common call objectRequires user access tokenNo org level(admin)operationsBRKCOL-301514 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebhook Notifications
14、/EventsWebhook API to manage webhooks:https:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveTelephony_call event exampleid:Y2lzY2wMTc5,name:d9c193c3-4787-4726-b9fa-6acff173e15a,targetUrl:https:/c780-149-249-133-109.ngrok.io/callevent/Y2lzY29.ZWIzZGE,resource:telephony_ca
15、lls,event:created,orgId:Y2lzmUzZTc,createdBy:Y2lzZGE,appId:Y2lzY29zc5NzZlZWQ0ODM1,ownedBy:creator,status:active,created:2022-03-18T14:53:51.669Z,actorId:Y2lzY22FjZWIzZGE,data:eventType:received,eventTimestamp:2022-03-18T14:54:02.442Z,callId:Y2lzY2AxNDYxOTow,callSessionId:Zjg1OWExYTYtNDI5NS00OTU0LWEw
16、YzktMDY0MjFjOTY5Mzk3,personality:terminator,state:alerting,remoteParty:name:Henry Green,number:7101,personId:Y2lzY29zzNTg,privacyEnabled:false,callType:location,appearance:1,created:2022-03-18T14:54:02.440ZWebhook IDWebhook nameTarget URLResource“telephony_calls”call eventCreated new callId of app u
17、sed to create the webhookInformation about the actual callBRKCOL-301516 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWebex Calling APIs Overview Detailed call records Onboarding,usage,&quality reporting Automated reporting setup Place,answer,hang up calls Stop/start/pau
18、se recording Transmit DTMF digits List active calls/get history Manage users,phone#s,locations,&services Assign licenses Create and manage location featuresRepresentative TasksCustomer JourneySetup,Onboard,Manage Call,Meet,CollaborateAchieve Customer SuccessSample Solutions Installation,activation,&
19、onboarding Ongoing services management&care Self-service via partner portal Custom enterprise calling integrations Cloud business platform integration Custom app development PROVISIONINGCALL CONTROLANALYTICS&REPORTING User training&adoption services Business process design&optimization Vertical solu
20、tions design&oversightBRKCOL-301517Getting Started 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUsing Webex APIsDocumentation at:https:/ learning curveA lot of concepts to masterSDK helps to abstract from the“dirty details”BRKCOL-301519 2023 Cisco and/or its affiliates.
21、All rights reserved.Cisco Public#CiscoLiveDeveloper SandboxSandboxplayground to test API callsAvoid impact on production orgLimited to 10 usersAllows to test capabilities not available w/Webex free plansNo Cisco PSTNCan add Local Gateway for PSTN accessWorking on a solution to get PSTN added to sand
22、boxhttps:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveInstalling PythonInstallers are are available at https:/www.python.org/downloads/Mac tip:install Python via Homebrew:https:/docs.python-guide.org/starting/install3/osx/Avoids issues with GNU readline(for example wh
23、en using https:/pypi.org/project/cmd2/)BRKCOL-301521Tools 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveIDE Integrated Development EnvironmentHelps to develop and test your applicationFeaturesGUIEditorBuild automationSyntax highlightingDebuggerIntegration w/revision cont
24、rol system(e.g.Git)BRKCOL-301523 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveSyntax Highlighting What Do you prefer?This?BRKCOL-301524 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveSyntax Highlighting What Do you prefer?Or this?BRKCOL-30152
25、5 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveLive DebuggerLive Debugger allows toSet breakpointsCheck variablesEvaluate expressions Essential for effectiveSW developmentBRKCOL-301526 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveIDEs for P
26、ythonIDLE(Standard IDE)PyCharmVS CodePythonAnywhereCloud9(AWS)BRKCOL-301527 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLivePostman:Test APIsShare,test,document&monitor APIsEasily test API callsGenerate code(Python,curl,.)Create collectionsAvailable for Mac,Windows,Linux,a
27、nd Chrome appshttps:/ collection for Webex Teams:https:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveRequestBin:See Webhooks in ActionFree service:https:/ unique URLUse case:Webex webhook pointing to Requestbin to test webhook operationProvides real-time view on reques
28、ts hitting the URLBRKCOL-301529 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveGitHubGit repository hosting serviceOffersRevision controlSource code managementTHE place to share your codeBRKCOL-301530Consuming APIs 2023 Cisco and/or its affiliates.All rights reserved.Cisc
29、o Public#CiscoLiveCalling a Webex API EndpointListing Webex Calling LocationsURL of the endpointSession()from requests module is usedFabricate the Authorization headerCall the endpointCheck for errorsParse the JSON response into a dictAccessing the response values as dict keyshttps:/ 2023 Cisco and/
30、or its affiliates.All rights reserved.Cisco Public#CiscoLiveCalling a Webex API EndpointListing Webex Calling LocationsBRKCOL-301533 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveCalling a Webex API EndpointListing Webex Calling LocationsURL of the endpointSession()from
31、requests module is usedFabricate the Authorisation headerCall the endpointCheck for errorsParse the JSON response into a dictAccessing the response values as dict keysThat was easy,but.Accessing dictionary values by key is hard and error prone Missing handling of 429 responses(throttling)Missing pag
32、ination handling Handling of additional parameters(name,id)There hashas to be a better way?!BRKCOL-301534 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLivewxc_sdk:SDK for Webex Calling APIsPyPi:https:/pypi.org/project/wxc-sdk/Homepage:https:/ SDK to work with Webex APIsFocu
33、s on Webex Calling specific endpoints.and moreTakes care of all the“ugly”stuffJSON(de-)serialisation,authentication,429 retries,Pagination,LoggingPython objects for all API objectsTab completion efficient codingActively maintainedNew API endpoints will be added continouslyFoundation for your provisi
34、oning automation and other projects around Webex CallingBRKCOL-301535 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveCalling a Webex API EndpointListing Webex Calling Locations using the SDKThe API objectGet list of locationsAccess data using attributes of Python classesh
35、ttps:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveCalling a Webex API EndpointListing Webex Calling Locations using the SDKBRKCOL-301537 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLivewxc_sdk:Comprehensive CoverageSDK covers all Webex Calli
36、ngspecific API endpointsAdditionally:Licenses,memberships,messages,people,teams,team memberships,webhooks,Easy token managementhttps:/wxc-sdk.readthedocs.io/en/latest/BRKCOL-301538Tokens 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveTokensWhy and How?Access tokens are re
37、quired to authorize API accces.Can be obtained in different ways:Personal access token(developer token)Integration(OAuth2 authorization flow)Service AppNEVER(!)store tokens in your source filesNEVER(!)push tokens to GitHub repositoriesNEVER(!)share tokens in any shape or formBest practice:In your co
38、de read access token from environment variableUse dotenv.loadenv()to load.env file with environment variablesExclude.env from version control(Git)by adding exclusion in.gitignoreIntegration tokens can be cached in local files.but make sure to restrict access and not push to GitHubhttps:/ https:/ MGY
39、4MzNjNzgt*content-type:application/json;charset=utf-8BRKCOL-301540 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLivePersonal Access TokenFrom Limited lifetime(12 h)Should NEVER be used in productionTesting onlyBRKCOL-301541 2023 Cisco and/or its affiliates.All rights reserv
40、ed.Cisco Public#CiscoLivePersonal Access TokenFrom Limited lifetime(12 h)Should NEVER be used in productionTesting onlyBRKCOL-301542 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveIntegration The Better Way to Obtain TokensAct on behalf of a Webex userAccess equivalent to
41、 a real Webex User(limited by authorized scopes)Invoke Webex APIs on behalf of userRequires authorization of integration by user OAuth Grant Flow to authenticate user and ask for authorizationUser approves authorization levels(scopes)requested by the integrationEach Integration has a client ID,clien
42、t secret and redirect URIDocumentation:https:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveOAuth Authorization Code Flow1.Application Requests auth codeBrowser redirect to Webex Authentication4.Application gets access token and refresh tokenHTTP GET response from Webex
43、 API2.Webex returns the auth code to applicationBrowser redirect to Application3.Request an access tokenHTTP GET request to Webex APIBRKCOL-301544 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveIntegration Tokens in Scripts Using wxc_sdkwxc_sdk offers an easy way to work
44、with cached tokens in scriptsCache tokens in YML fileGet tokens from OAuth flow redirecting tohttp:/localhost:6001/redirectSpin up temporary(primitive)server to handlefinal step of OAuth flowBRKCOL-301545https:/ integration based on values read from environmentRead,create,refresh,cache tokensaccess_
45、token:ZGVlY2*expires_at:2023-05-30T14:35:37.246110+00:00refresh_token:NTlk*refresh_token_expires_at:2023-08-14T14:08:57.246110+00:00token_type:Bearer 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveIntegration Tokens in Scripts Using wxc_sdkWithout cached tokens OAuth flow
46、 gets initiatedAuth code exchanged for tokensTokens are cachedNext execution uses cached tokens46BRKCOL-3015https:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveService AppsMachine accountRequest admin permission independent of user accountUse casesProvisioningReporting
47、Scheduling systemsSimilar to integrations.but no user specific authorization flowBRKCOL-301547 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUsing Service App Tokens Register service appRequest admin authorizationRetrieve access and refresh tokenUse access token to make
48、API callsGet new access tokenAdmin authorizes appDeveloperAdminClient id and secretRefresh tokenClient idBRKCOL-301548Token lifetime expired 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveClient idUsing Service App Tokens Register service appRequest admin authorizationRet
49、rieve access and refresh tokenUse access token to make API callsGet new access tokenAdmin authorizes appDeveloperAdminClient id and secretRefresh tokenBRKCOL-301549 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUsing Service App Tokens Register service appRequest admin a
50、uthorizationRetrieve access and refresh tokenUse access token to make API callsGet new access tokenAdmin authorizes appDeveloperAdminClient id and secretRefresh tokenBRKCOL-301550Token lifetime expiredD,“My Webex apps”Define:NameIconDescriptionContact email addressScopesCollectClient idClient secret
51、Client id 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUsing Service App Tokens Register service appRequest admin authorizationRetrieve access and refresh tokenUse access token to make API callsGet new access tokenAdmin authorizes appDeveloperAdminClient id and secretRe
52、fresh tokenBRKCOL-301551Token lifetime expiredClient id 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUsing Service App Tokens Register service appRequest admin authorizationRetrieve access and refresh tokenUse access token to make API callsGet new access tokenAdmin auth
53、orizes appDeveloperAdminClient id and secretRefresh token“Apps”section in Control HubReview scopesAuthorizing user is documentedBRKCOL-301552Token lifetime expired 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUsing Service App Tokens Register service appRequest admin au
54、thorizationRetrieve access and refresh tokenUse access token to make API callsGet new access tokenAdmin authorizes appDeveloperAdminClient id and secretRefresh tokenDeveloper requests tokens for authorized orgClient secret needed to authorize the requestBRKCOL-301553Token lifetime expiredClient id 2
55、023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUsing Service App Tokens Register service appRequest admin authorizationRetrieve access and refresh tokenUse access token to make API callsGet new access tokenAdmin authorizes appDeveloperAdminClient id and secretRefresh token
56、When getting close to token lifetimeNew access token can be obtained using the refresh tokenPOST https:/ body-access_token:*,expires_in:1209599,refresh_token:”*,refresh_token_expires_in:7775954,token_type:Bearer,scope:spark:kms BRKCOL-301554Token lifetime expiredClient id 2023 Cisco and/or its affil
57、iates.All rights reserved.Cisco Public#CiscoLiveToken Overview55BRKCOL-3015Developer TokenDeveloper TokenIntegration TokenIntegration TokenService App TokenService App TokenHow to getFrom Requires OAuth auth code authorization flow,web server requiredService app access to org granted by org admin.Se
58、rvice app owner creates token on Granular Access ControlNo,always has all scopesSet of scopes assigned to integrationSet of scopes assigned to service appActorOwner of developer tokenUser granting authorizationService appLifetime12 hrsAccess token:14 dRefresh token:90 d(extended when getting new acc
59、ess token)Use casesDevelopment,Tests(Web)applications acting on behalf of user(Web)services explicitly authorized by org adminUse Cases/Examples 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUse CasesScriptsBulk Provisioning:user,calling features,Validation:check/verify
60、settings;scripting saves you from navigating through individual menus in ControlHubAutomation reduces the risk of errors in repetitive tasksCLI toolsIntegration with existing enterprise mangement systems/toolsBackend for web services(portal applications)BRKCOL-301557 2023 Cisco and/or its affiliates
61、.All rights reserved.Cisco Public#CiscoLiveSDK ExamplesExamples available at:https:/wxc-sdk.readthedocs.io/en/latest/examples.htmlhttps:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveExamplesqueue_helper.py:read/update call queue join state of userscall_intercept.py:rea
62、d/update call intercept settings of a userus_holidays_async.py:create schedule with US holidays for all US locationreset_call_forwarding.py:reset call forwarding settings for all usersusers_wo_devices.py:identify users without devicescatch_tns.py:pool unassigned TNs on hunt groups to catch calls to
63、unassigned TNsBRKCOL-301559Example:User Web Portal 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveUser Web PortalOnly a limited set of configuration options is available for users on User portal can expose additional options(which usually require admin privileges)Perfect
64、example for using service app tokensUser does not have the required privileges integration token granted by user not sufficient61BRKCOL-3015 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveConceptsWeb based portalAuthenticate users using“Login with Webex”For provisioning o
65、perations portal uses service app tokensBrowser only interacts with portal endpointsIncludes Javascript Ajax accessPortal acts as proxy between browser and Webex APIs62BRKCOL-3015https:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveLogin with Webex63BRKCOL-3015UserBrows
66、erPortalWebexInitiates loginAccess authentication URLRedirect to URL to start auth flowAccess URL to start auth flowUser authenticatesRedirect to redirect URL(portal)w/auth codeAccess redirect URL w/auth codeRequest ID token,use ID token to get info about authenticated user,set session context 2023
67、Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLivePortal Transactions64BRKCOL-3015UserBrowserPortalWebexOpens dashboard pageAccess portalRender pageJavascript AJAX accessInteract with APIsInteract with APIsAJAX responseChanges settingsJavascript AJAX accessInteract with APIsAJAX
68、responseDemo Web App 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveDisclaimer,Where to Go NextDemo code is not“production ready”Missing token lifetime monitoringFilesysten based session backendWhere to go nextAdd roles:can be based on groups in WebexAdditional functions:
69、manage devices,bulk update,66BRKCOL-3015Closing 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveReferencesWebex for Developers:https:/ for the session on GitHubhttps:/ SDK:https:/pypi.org/project/wxc-sdk/SDK Examples available at:https:/wxc-sdk.readthedocs.io/en/latest/exa
70、mples.htmlhttps:/ control bot:https:/wxc-callcontrol.readthedocs.io/en/latest/BRKCOL-301568 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveFill out your session surveys!Attendees who fill out a minimum of four session surveys and the overall event survey will get Cisco Li
71、ve-branded socks(while supplies last)!These points help you get on the leaderboard and increase your chances of winning daily and grand prizesAttendees will also earn 100 points in the Cisco Live Challenge for every survey completed.BRKCOL-301569 2023 Cisco and/or its affiliates.All rights reserved.
72、Cisco PublicContinue your educationVisit the Cisco Showcase for related demosBook your one-on-oneMeet the Engineer meetingAttend the interactive education with DevNet,Capture the Flag,and Walk-in LabsVisit the On-Demand Library for more sessions at www.CiscoL you#CiscoLive 2023 Cisco and/or its affi
73、liates.All rights reserved.Cisco Public#CiscoLive72Gamify your Cisco Live experience!Get points for attending this session!Get points for attending this session!Open the Cisco Events App.Click on Cisco Live Challenge in the side menu.Click on View Your Badges at the top.Click the+at the bottom of the screen and scan the QR code:How:123472 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicBRKCOL-3015#CiscoLive