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.
已解决! 转到解答。
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' ))
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.
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.
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' ))
That is one command missing. it need to import the request module.
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