Skip to content

CiscoDevNet/webexTeams-ContactAlertWhenAvailable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How To Improve WebEx Teams (IM) Productivity?

Table of Contents

The Challenge and suggested solution

Do you know/remember this GREAT feature in the Jabber chat menu?
json

If not, a quick recap.. that option configures Jabber to notify you when your contacts are available (i.e., online).
This makes it easier to know if other people are available to respond to your messages.

Well, for some reason, this option is missing from the WebEx Teams chat menu.
json

So, without getting into a “Jabber vs. WebEx Teams” discussion... I was wondering, how can I add that missing functionality? I’m not a WebEx Teams developer…

What can we do.. what can we do.. let’s think…

I GOT IT!

json

  1. Does WebEx Teams expose its API? YES! 👍
  2. Is there an API call to check a user connection status? YES! 👍
  3. Can I use a CLI command to trigger an API call? YES! 👍

Interesting! But...

  • How can I add a new option to the WebEx Teams chat menu?
  • What about the WebEx Teams API tokens limitation?
    • The personal token is limited for 12 hours
    • The guest user token cannot access the “status” data as it isn’t part of the organization
    • The integration token (OAuth grant using a web browser) isn’t applicable for a simple script

  1. True, I cannot modify the WebEx Teams chat menu… but, can AppleScript execute a CLI (cURL) command? YES! 👍
  2. Since a WebEx Teams Bot is part of the organization, can I create a new Bot and use its (permanent) API token? YES! 👍

Problem Solved!

I created a:

Procedure - Click on the Hyperlink
- Log in to Cisco WebEx Developer site
- Under the "Bots" main section, click on "Create a Bot"
- Enter the required information (e.g. Bot name, username). Note: make sure that the Bot username is valid and available)
- Once done, click on "Add Bot"
- The next window will include the following: "Bot's Access Token" and "Bot ID" (You will need the Token ID for step #8)
  • cURL command & parsing statement to retrieve the user status
Sample Command
curl -s --request GET --url 'https://api.ciscospark.com/v1/people?email=ymeloch%40cisco.com' --header 'Authorization: Bearer [TOKEN]' | json_pp | grep status | awk '{print $3}' | tr -dc '[:alnum:]'
  • AppleScript to:
    • Query (via dialog box) for the user CEC ID
    • Execute (10 sec. loop) in the background the cURL command
    • Notify when the user becomes active 😃
Sample Command
set userName to text returned of (display dialog "Enter a CEC User Name (e.g., ymeloch)" default answer "" with title "WebEx Teams - Active User Notification" with icon note)
set theAlertText to "WebbEx Teams - Active User Notification"
set theAlertMessage to "" & userName & " User is now active"
set n to 1
repeat
 	delay 10
	set theName to do shell script "curl -s --request GET --url 'https://api.ciscospark.com/v1/people?email=" & userName & "%40cisco.com' --header 'Authorization: Bearer [TOKEN]' | json_pp | grep status | awk '{print $3}' | tr -dc '[:alnum:]'"
	if theName = "active" then (display dialog theAlertMessage with title "WebEx Teams - Active User Notification" with icon stop buttons {"Exit"} default button "Exit" cancel button "Exit")
end repeat

And the results are:

json

Script Initialization

Repo Clone

  1. Open a Terminal window (Press CMD + Space, type "Terminal" and hit return).

  2. Clone the code to your workstation (Copy & Paste the commands below).

    cd /tmp
    git clone https://github.com/CiscoDevNet/webexTeams-ContactAlertWhenAvailable.git
    cd webexTeams-ContactAlertWhenAvailable
    

Configuration & Usage

  1. Using your preferred editor, edit the "userActiveNotification.scpt" file and replace the [TOKEN] entry with your WebEx Teams Bot Token ID (Note: For Token information, please check above under the "New WebEx Teams Bot (for an “inside-org-permanent” API token) section").

  2. Save the file.

  3. Copy the modified file to AppleScript scripts folder (/Users/[user-ID]/Library/Scripts ).

  4. Run the script (If the "Show Script menu in menu bar" option is enabled, you can run the script from the menu bar).

Tools & Frameworks

  • This code requires a Mac OS

Getting help & involved

Need help with the code? Got questions/concerns? Want to provide feedback?
Please contact Yossi Meloch

Authors & Maintainers

📧 Yossi Meloch

Licensing info

This project is licensed to you under the terms of the Cisco Sample Code License

About

Webex Teams contact alert when available

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published