04-12-2020 01:23 AM - edited 04-14-2020 12:54 PM
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
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.
</edit>
Solved! Go to Solution.
04-13-2020 03:24 AM - edited 04-13-2020 03:41 AM
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
04-14-2020 12:15 AM - edited 04-14-2020 12:28 AM
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
04-14-2020 12:15 AM - edited 04-14-2020 12:28 AM
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
04-14-2020 12:47 PM
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!
04-14-2020 01:09 PM
Shall I quote Robert Frost's famous poem here?
Some paths are more fun and challenging. I applaud you for tackling that route.
Enjoy!
04-12-2020 03:03 AM
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
04-12-2020 04:42 AM
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 :)?
04-12-2020 12:22 PM
04-12-2020 05:39 AM - edited 04-12-2020 12:24 PM
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.
04-12-2020 08:43 PM
@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
Time to give up and keep sanity - but thanks for your help.
04-13-2020 03:24 AM - edited 04-13-2020 03:41 AM
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
04-13-2020 01:49 PM
@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
04-13-2020 02:07 PM - edited 04-13-2020 02:08 PM
@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
04-12-2020 05:43 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide