07-14-2020 02:30 PM
I am interested in using webex bots or anything else that would take a body of an email and post it into a webex room. We have automated emails that come from a system and I would prefer those to be in a webex space that would get noticed sooner.
Solved! Go to Solution.
07-21-2020 02:45 AM
Here's a version of your script that variable-izes things:
url = 'https://webexapis.com/v1/messages' message = '**Test Message**' roomId = 'Y2lzY29zcGFyazovL3Vz***********************************************L1mYzRhYTM2YjVi' token = 'NGEyYjhlMGItZjg1*********************************************17ae04-c4aa-4444-9f54-4bebcee07305' payload = { 'roomId': roomId, 'markdown': message } headers = { 'Authorization': f'Bearer { token }', 'Content-Type': 'application/json' } response = requests.request( 'POST', url, headers = headers, json = payload ) print( response.text.encode( 'utf8' ))
07-14-2020 03:16 PM
Hello,
Bot tokens can be used to message Webex Teams spaces that the bot has been added to using the POST method for the /meetings endpoint, documented at https://developer.webex.com/docs/api/v1/messages/create-a-message.
07-20-2020 02:49 PM
I have been playing with the bots and i have a python script that will post what i type in the script but i am having some trouble with adding a variable. I want the message to be a variable that I can input later.
07-21-2020 02:45 AM
Here's a version of your script that variable-izes things:
url = 'https://webexapis.com/v1/messages' message = '**Test Message**' roomId = 'Y2lzY29zcGFyazovL3Vz***********************************************L1mYzRhYTM2YjVi' token = 'NGEyYjhlMGItZjg1*********************************************17ae04-c4aa-4444-9f54-4bebcee07305' payload = { 'roomId': roomId, 'markdown': message } headers = { 'Authorization': f'Bearer { token }', 'Content-Type': 'application/json' } response = requests.request( 'POST', url, headers = headers, json = payload ) print( response.text.encode( 'utf8' ))
06-20-2023 10:35 PM - edited 06-20-2023 10:36 PM
That is one command missing. it need to import the request module.
07-21-2020 06:40 AM
Thank you that worked
I added message = (input_data['message']) this so I can handle inputs. That is a bit closer to what I want. Thank you
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