Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with a Python script that sends JEC events to a Webex Team Space

Tom Davison
May 22, 2026

Hello,

I am in need of help on a Python script that I unfortunately am not a Python expert at all.  The issue is, currently we are successfully able to send an event coming from JSM to JEC and see it in the corresponding Webex Team Space, but, in the Alert Rules, if we have multiple teams in the Responders field, it only send the event to one of the teams and not both.

I believe this is where the script is looking for the team names:


if queue_message["action"] == "Create":
markdownPrefix = "**NEW " +alertPriority +" Alert:** "
if "team" in queue_message["alert"]:
alertTeam = queue_message["alert"]["team"]
else:
alertTeam = "unassigned"


I have no idea how to modify the Python script so it will look at both teams.

Here is the actual event, where I can see the "team" field, only showing one of the 2 teams.  But, I do see another "team" field within "type" that is showing both of the teams.

 


"alert":{"alertId":"124940e9-b533-4dd0-9e79-873359e777b5-1779466299779","id":"124940e9-b533-4dd0-9e79-873359e777b5-1779466299779","type":"alert","message":"TEST Alert","tags":[],"tinyId":"278357","entity":"","alias":"1056bed8-6256-4dfa-8ca1-9aeedbd675e7","createdAt":1779466299779,"updatedAt":1779466300640000000,"username":"TEST","team":"Monitoring_Admin","responders":[{"id":"f8c9079d-c7bb-4e58-ac83-359cb217a3b5","type":"team","name":"Monitoring_Admin"},{"id":"4a16a8bb-2e50-4fb2-8885-173bc7ea7384","type":"team","name":"OEC_Monitoring"}],"teams":["f8c9079d-c7bb-4e58-ac83-359cb217a3b5","4a16a8bb-2e50-4fb2-8885-173bc7ea7384"],"actions":[],"priority":"P3","source":"TEST"}

 

Any help on this one would make my year, really appreciate it in advance.

Just let me know if more details are needed.

Thanks,

Tom

1 answer

0 votes
Alexander Nilsson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 22, 2026

Hello Tom,

good catch, you found the right line. The reason only one team comes through is that queue_message["alert"]["team"] is the legacy single-team field and only ever holds one value, even when the alert routes to multiple teams. The full team list lives in queue_message["alert"]["responders"], which you can see in your own payload contains both Monitoring_Admin and OEC_Monitoring as objects with type, id and name.

The alert action data structure JEC delivers to the script is documented here:

https://support.atlassian.com/jira-service-management-cloud/docs/alert-action-data-for-jira-edge-connector/

To pull both team names out, walk the responders list and keep the entries where type == "team". Something like this in place of your current if "team" in ... block:

if queue_message["action"] == "Create":
    markdownPrefix = "**NEW " + alertPriority + " Alert:** "

    responders = queue_message["alert"].get("responders", [])
    team_names = [r["name"] for r in responders if r.get("type") == "team"]

    if team_names:
        alertTeam = ", ".join(team_names)
    else:
        alertTeam = "unassigned"

A couple of notes on robustness. The responders list can also contain users, escalations and schedules, so the type == "team" filter is what keeps the output clean. The .get() calls protect against payloads where the field is missing entirely (for example on some action events other than Create). If you want a stable order regardless of how JEC sends them back, wrap a sorted() around team_names before the join.

One thing to flag: scripting itself is outside Atlassian Support's scope (their JEC KB makes that explicit, they only verify that JEC delivers the payload correctly), so once the parsing works you are on your own for further script changes. The Community is the right place for these, which you already found.

I am really looking forward to your reply :) 

Greetings,

Alex

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events