Saturday, November 7, 2026
HomeIoTEnhancing Webex Messaging Utilizing Webex APIs & AppleScript

Enhancing Webex Messaging Utilizing Webex APIs & AppleScript

[ad_1]

Webex alert menuDo you bear in mind the “Alert When Accessible” function within the (outdated) Cisco Jabber chat menu? If not, here’s a fast recap. The “Alert When Accessible” choice configured Cisco Jabber to inform you when your contacts can be found (i.e., on-line/energetic). This makes it simpler to know if different persons are accessible to answer your messages.

For some motive, this selection is lacking from the Webex chat menu 🙄. So, with out getting right into a Jabber vs. Webex dialogue, I puzzled how I can improve the Webex person expertise and add that lacking performance?

What can we do.. Let’s suppose… 🤔

  1. Does Webex expose its API?… YES!
  2. Is there an API name to verify the person connection standing?… YES!
  3. Can I take advantage of a CLI command to set off an API name?… YES!

Fascinating! However…

  • How can I add a brand new choice to the Webex chat menu?
  • What concerning the Webex API tokens limitation?
    • The non-public entry token is restricted to 12 hours.
    • The visitor person token can not entry the “standing” information because it isn’t a part of the group.
    • The combination token (OAuth grant utilizing an online browser) isn’t relevant for a easy script.

I acquired it! 💡

  1. True, I can not modify the Webex chat menu… however, can AppleScript execute a CLI (cURL) command?… YES!
  2. Since a WebEx Bot is a part of the group, can I create a brand new Bot and use its (everlasting) API token?… YES!

Drawback Solved! 👍

So… I created a:

  1. cURL command & parsing assertion to get the person standing.
  2. New Webex Bot (for an “inside-org-permanent” API token).
  3. AppleScript to:
    1. Question (by way of dialog field) for the person CEC ID.
    2. Set a 5 seconds loop for the cURL command.
    3. Show a dialog field to inform when the person turns into energetic.

The Code (Mac OS solely) 👨‍💻

1  set userName to textual content returned of (show dialog "Enter a CEC Person Title (e.g., ymeloch)" default reply "" with title "Webex - Energetic Person Notification" with icon file "Purposes:Webex.app:Contents:Sources:webexteams.icns")
2  set theAlertText to "WebbEx Groups - Energetic Person Notification"
3  set theAlertMessage to "" & userName & " Person is now energetic"
4  ​
5  set n to 1
6  repeat
7     delay 5
8     set theName to do shell script "curl -s --request GET --url 'https://api.ciscospark.com/v1/individuals?electronic mail=" & userName & "%40cisco.com' --header 'Authorization: Bearer [webex-bot-token]' | json_pp | grep standing | awk '{print $3}' | tr -dc '[:alnum:]'"
9  if theName = "energetic" then (show dialog theAlertMessage with title "Webex - Energetic Person Notification" with icon file "Purposes:Webex.app:Contents:Sources:webexteams.icns" buttons {"Exit"} default button "Exit" cancel button "Exit")
10 finish repeat

The Code Defined

  • Line #1 – Outline the “userName” variable (== AppleScript show dialog with an “userName” enter request). BTW, see under for extra details about the Webex icon path.
  • Line #2 – Outline the “theAlertText” variable (== Fastened textual content, can be utilized in the primary methodology).
  • Line #3 – Outline the “theAlertMessage” variable (Contains the “userName” response and glued textual content).
  • Line #5 & #6 – Begin loop.
  • Line #7 – Outline delay interval.
  • Line #8 – Outline the “theName” variable (== The cURL command). Observe the cURL GET command and parsing 👉
curl -s --request GET --url 'https://api.ciscospark.com/v1/individuals?electronic mail=" & userName & "%40cisco.com' --header 'Authorization: Bearer [webex-bot-token]' | json_pp | grep standing | awk '{print $3}' | tr -dc '[:alnum:]'
  • cURL Command Defined:
    • [REST API Call] -s – Silent operation (no cURL command output printouts).
    • [REST API Call] –request GET – Ship a GET request.
    • [REST API Call] –url – The URL of the GET request.
      • Observe the “& userName &” within the URL. That’s the place we leverage the “userName” variable from line #1.
      • Observe the “%40cisco.com” string within the URL (I changed the “@cisco.com” string with a parseable string “%40cisco.com”).
    • [REST API Call] –header ‘Authorization: Bearer [webex-bot-token]’ – The authorization methodology (Bearer) to execute the API name.
    • [Parsing Statment] | json_pp – Converert the API name output to a JSON format.
    • [Parsing Statment] | grep standing – Seek for (solely) a line with the phrase “standing”.
    • [Parsing Statment] | awk ‘{print $3}’ – If a line with the phrase “standing” is discovered, print (solely) the third phrase.
    • [Parsing Statment] | tr -dc ‘[:alnum:]’ – Take away non-alphanumeric characters from the earlier output (“energetic”, 👉 energetic).
    • Line #9 – “If” assertion (on the lookout for “energetic” standing).
    • Line #10 – Finish loop (as soon as execution accomplished).

❗️Observe: So as to add the Webex icon to the AppleScript dialog, I extracted the webex.app file, and situated the ​​​​​​​”webexteams.icns” file.

Demo 🎥

Disclaimers

  • As a way to tweak the Webex standing, I used inner API’s that are at all times topic to alter.
  • The above code is “POC (Proof of Idea) Grade” as I’m polling for the person standing each 5 seconds till it adjustments. A extra scalable manner can be to subscribe for notification by means of Webex inner API (I nonetheless want to seek out these calls 😉).

Last ideas

  • The ability of automation, innovation, and integration – Cool, proper! 😎
  • What’s your problem? Are you able to leverage automation/completely different applied sciences/programming languages to mitigate it?
  • Wish to be taught extra about APIs (== integration glue), automation, and Integration? What about cURL and AppleScript programming? Examine the AIDE Person Information or get in contact with the Cross-Area TAB staff.

Particular because of Paul Giralt for his evaluation and suggestions! 🙏

Associated developer sources


We’d love to listen to what you suppose. Ask a query or depart a remark under.
And keep linked with Cisco DevNet on social!

Twitter @CiscoDevNet | Fb | LinkedIn

Go to the brand new Developer Video Channel

Share:



[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments