cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
17321
Views
20
Helpful
12
Replies

How do I bulk add email addresses to a Webex Teams Space

RedNectar
VIP
VIP

Hi Experts,

I often setup training sessions and add every user to a Webex Teams space.  However, I have yet to find a way to do this efficiently.  The only way I've been able to do it involves adding each person one-at-a-time, and simultaneously demonstrating what a clumsy UI Webex Teams has for adding multiple users. At times it has been so painful I've simply given up.

Does anyone know of an efficient way of adding multiple participants to a space, such as

  1. paste a list of email address
  2. import a list of email addresses from a file
  3. generate a link I could email to enable to join the space
  4. generate a URL that they could click to join the space
  5. any other efficient way..

Note: I realise I COULD invite them to a meeting, or share a meeting link. But that't NOT what I want to do. I want to share a space so I can share a whiteboard with everyone. That's all. No meeting. I've been down that path and it ends up a total mess - users end up getting Spark installed (NOT Webex Teams) and trying to join video - total mess.

<Edit> 2020.04.15 In the end two perfectly good solutions were found for this problem. I'll save you from reading the next 10 pages of discussion by providing key links here.

  1. The fastest way to do this is using the Webex Power Pack. See @SiliconRichard's answer: https://community.cisco.com/t5/webex/how-do-i-bulk-add-email-addresses-to-a-webex-teams-space/m-p/4065220/highlight/true#M981
  2. The "fun" way to do it is to run a script. After fumbling around, @omz gave me a script here: https://community.cisco.com/t5/webex/how-do-i-bulk-add-email-addresses-to-a-webex-teams-space/m-p/4064565/highlight/true#M939

</edit>

 

 

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.
2 Accepted Solutions

Hi @RedNectar 

I have written a quick script .. IF you fancy giving it a go .. should run in Python 2.7 and 3. 

 

1. Create a new room or use an existing room in the Webex Team app 

2. Get room id where we want to add new users.

- Add inspect@webex.io bot to your room to ask for the roomId. example: @inspector roomId  

- OR Login to - https://developer.webex.com/docs/api/v1/rooms/list-rooms - to get the roomId

 

In the script below - replace room_id , bearer token and filename to match yours. 

#!/usr/bin/env python
# Author - omz - 13/04/2020
# below packages can be installed from pip
# pip install requests json import requests import json # Define Method to post data to API def person_post(url, data): response = requests.post(url, data=json.dumps(data), headers={"Accept" : "application/json", "Content-Type":"application/json", "Authorization": "Bearer "+bearer}) return response ################### REPLACE ############################## #each user on a new line. no last blank line. filepath = "people_emails.txt" # room to add new users room_id = "COPY/PASTE ROOM ID HERE" # add webex api admin token bearer = "COPY/PASTE API TOKEN HERE" ########################################################## # empty list to hold the email addresses emails = [] # open file to read the email addresses with open(filepath, 'r') as read_emails: emails = read_emails.readlines() # uncomment below line to check emails addresses are read from the text file #print emails # url to add new user to the room add_membership_url = 'https://api.ciscospark.com/v1/memberships' print for email in emails: # every email address in the lines list try: param = { "roomId": room_id, "personEmail": email, } # strip off any carriage return or new line characters from email person_email = email.strip('\r\n') # call the person_post method with 2 parameters, add_membership_url and payload result = person_post(add_membership_url,param) #print(result.status_code) if result.status_code == 409: print("{} - is already in the room.".format(person_email)) elif result.status_code == 200: print("{} - is successfully added to the room.".format(person_email)) else: result.json() print(result.status_code, result['message']) # uncomment below to see what error message is sent from the api #print(result.json()) except Exception as e: print(e) print

The script uses a text file named - people_emails.txt - to read emails. The text file looks like this - 

pybot1@sparkbot.io
gifbot@webex.bot
inspect@webex.bot

 

 

View solution in original post

SiliconRichard
Cisco Employee
Cisco Employee

Others have used PowerPack: https://apphub.webex.com/teams/applications/power-pack-power-pack

 

 

I'm also a big fan of the bot named EURL. You can add him to the space as a moderator. He generates a shareable URL which users can click to join. Add EURL like you would as a person to the space by using eurl@sparkbot.io and then once he is in the space you can "call" him by mentioning him @EURL  and then the command. Try starting with "@EURL help" to get the guide but the command you are seeking is "@EURL url" which will then generate a URL you can copy and share with users. (KEEP IN MIND ANYONE WITH THIS URL CAN JOIN!) If you want to prevent new users from adding from the URL simply remove EURL from the space.

 

https://help.webex.com/en-us/n0qp3oeb/Connect-Your-Tools-and-Automate-Tasks

View solution in original post

12 Replies 12

SiliconRichard
Cisco Employee
Cisco Employee

Others have used PowerPack: https://apphub.webex.com/teams/applications/power-pack-power-pack

 

 

I'm also a big fan of the bot named EURL. You can add him to the space as a moderator. He generates a shareable URL which users can click to join. Add EURL like you would as a person to the space by using eurl@sparkbot.io and then once he is in the space you can "call" him by mentioning him @EURL  and then the command. Try starting with "@EURL help" to get the guide but the command you are seeking is "@EURL url" which will then generate a URL you can copy and share with users. (KEEP IN MIND ANYONE WITH THIS URL CAN JOIN!) If you want to prevent new users from adding from the URL simply remove EURL from the space.

 

https://help.webex.com/en-us/n0qp3oeb/Connect-Your-Tools-and-Automate-Tasks

@SiliconRichard 

What can I say? After spending half my Easter break trying to get the darn script to work, you come up with a solution (Power Pack) that works in seconds!

Anyway, I had fun writing the script.

I'll put an edit in the orignial post so future readers can find both answers!

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

Shall I quote Robert Frost's famous poem here?

 

Some paths are more fun and challenging. I applaud you for tackling that route.

 

Enjoy!

omz
VIP Alumni
VIP Alumni

Hi RedNectar 

You didn't mention any programming options .. is using API an option?

You can use WebEx Teams API to manage users.

https://developer.webex.com/docs/api/v1/memberships

hope this helps 

Hi @omz ,

 

This is looking promising, although I could find no way of actually getting the "room ID" from the Webex teams app istself, I was ablt to figure it out by using the web login.

Thus far I have managed to add one person, I just have to figure out how to script it to add multiple...

Looking promising. Thanks for the direction.

Anyone ever written a script to tdo this :)?

 

 

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

The simplest way to find the roomId for Teams is to add the bot inspect@webex.bot to a room and ask it it for the roomId (case sensitive). It will then reply with the roomId for that room.

I don't think you can get the room_id from the app. 

you have to use the API to get the room_id. 

a simple for loop will add more than one person.. 

have a look at this blog post - 

https://developer.webex.com/blog/bulk-actions-using-the-webex-teams-api

 

please don't forget to rate any helpful posts :)

 

edit:

The simplest way to find the roomId for Teams is to add the bot inspect@webex.bot to a room and ask it it for the roomId (case sensitive). It will then reply with the roomId for that room.

@omz ,

Thanks so much for your help, but I'm afraid my python skills are not up to it.  Using the reference you gave (https://developer.webex.com/docs/api/v1/memberships/create-a-membership) allows me to paste in email addresses one at time more efficently than the Webex Teams app, so that might be my final solution. I've spent 5hrs trying to find out how to use the API, but the best I've been able to do is use a person's email address to

  1. check if they are already registered with Webex Teams
    1. ...but NOT how to add them to a space
  2. determine that they are not registered with Webex Teams
    1. ... but NOT how to add them to a space
  3. I can get a list of the members of a space, but have found no example of how to ADD a user to a SPACE.

Time to give up and keep sanity - but thanks for your help.

 

 

 

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

Hi @RedNectar 

I have written a quick script .. IF you fancy giving it a go .. should run in Python 2.7 and 3. 

 

1. Create a new room or use an existing room in the Webex Team app 

2. Get room id where we want to add new users.

- Add inspect@webex.io bot to your room to ask for the roomId. example: @inspector roomId  

- OR Login to - https://developer.webex.com/docs/api/v1/rooms/list-rooms - to get the roomId

 

In the script below - replace room_id , bearer token and filename to match yours. 

#!/usr/bin/env python
# Author - omz - 13/04/2020
# below packages can be installed from pip
# pip install requests json import requests import json # Define Method to post data to API def person_post(url, data): response = requests.post(url, data=json.dumps(data), headers={"Accept" : "application/json", "Content-Type":"application/json", "Authorization": "Bearer "+bearer}) return response ################### REPLACE ############################## #each user on a new line. no last blank line. filepath = "people_emails.txt" # room to add new users room_id = "COPY/PASTE ROOM ID HERE" # add webex api admin token bearer = "COPY/PASTE API TOKEN HERE" ########################################################## # empty list to hold the email addresses emails = [] # open file to read the email addresses with open(filepath, 'r') as read_emails: emails = read_emails.readlines() # uncomment below line to check emails addresses are read from the text file #print emails # url to add new user to the room add_membership_url = 'https://api.ciscospark.com/v1/memberships' print for email in emails: # every email address in the lines list try: param = { "roomId": room_id, "personEmail": email, } # strip off any carriage return or new line characters from email person_email = email.strip('\r\n') # call the person_post method with 2 parameters, add_membership_url and payload result = person_post(add_membership_url,param) #print(result.status_code) if result.status_code == 409: print("{} - is already in the room.".format(person_email)) elif result.status_code == 200: print("{} - is successfully added to the room.".format(person_email)) else: result.json() print(result.status_code, result['message']) # uncomment below to see what error message is sent from the api #print(result.json()) except Exception as e: print(e) print

The script uses a text file named - people_emails.txt - to read emails. The text file looks like this - 

pybot1@sparkbot.io
gifbot@webex.bot
inspect@webex.bot

 

 

@omz  - you're a legend!

I can see now that I was fairly close, but without revealing my stupidity too much, I'll just say that I now realise that POST and PUT are NOT the same thing, and python dictionaries are different to JSON lists (extra comma at the end)

I might come back to this in the future and see if I can get that bot working too, then write a blogpost!

Thanks for your help. Will be demo-ing this to my colleagues later today (the ones I've just added to my test Webex team using your script)

Have a great day/week/life.

Chris

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

@RedNectar glad I could be helpful :)

you are a legend mate - https://rednectar.net/

got a lot of help from your blog in gns3 days :)

really like your aci posts .. but unfortunately not actively involved in acid ... just learning atm

take care 

omz
VIP Alumni
VIP Alumni

if interested .. 

you could also look into creating a bot.

https://developer.webex.com/docs/bots

it can be helpful .. for example .. help people with faqs